Skip to content

Clarify document vs payload structure in insert.py and README#8

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/improve-documentation
Draft

Clarify document vs payload structure in insert.py and README#8
Copilot wants to merge 2 commits intomainfrom
copilot/improve-documentation

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 9, 2026

Students were confused about the relationship between the MongoDB document and the Lambda function payload, leading them to POST the document directly instead of wrapping it. The TODO in insert.py also omitted several required steps.

insert.py

  • Import TODO now specifies urequests and json
  • Replaced single vague TODO with 4 numbered steps: run experiment → build document (with course_id) → wrap in payload → POST to Lambda
  • Added the payload structure inline and a reference to mongodb_credentials_test.py

README.md

  • Fixed payload_dictsdocuments
  • Changed "Connect to MongoDB using the provided URI" → upload via Lambda function
  • Added callout distinguishing document (stored in MongoDB) from payload (sent to Lambda)
  • Split into two code blocks showing each structure separately:
# Document (what gets stored)
{"command": ..., "sensor_data": ..., "experiment_id": ..., "course_id": ...}

# Payload (what gets POSTed to Lambda)
{"database": DATABASE_NAME, "collection": COLLECTION_NAME, "document": <above>}
  • Removed timestamp from document example (not validated by tests)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/markdown/raw
    • Triggering command: /home/REDACTED/.local/bin/grip grip README.md --export /tmp/readme.html (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve documentation</issue_title>
<issue_description>Address feedback from AccelerationConsortium/ac-microcourses#221 (reply in thread)

at the time I was under the impression that payload is just the document with 'sensor_data' as added keys

There should be another line on insert.py that instructs us to put that document on a separate payload, or just something that indicates the document is part of the payload and use that function on mongo_db_credentials_test.py to upload to the database

I think the last TODO on insert.py has a lot more steps involved</issue_description>

<agent_instructions>compile the docs and verify the changes look good</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…t.py and README.md

Co-authored-by: sgbaird <45469701+sgbaird@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve documentation for payload handling Clarify document vs payload structure in insert.py and README Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve documentation

2 participants