Skip to content

Survey Creation Process

Anant Mittal edited this page Nov 11, 2025 · 6 revisions

Option 1: No referral code? Start new seed

  1. Creates a new seed document with:
{
  // generated by MongoDB on insertion
  "_id": {
    "$oid": "some-random-string-we-dont-care-about"
  },
  // A new and unique 8-character surveyCode that does not exist anywhere in the database
  "surveyCode": "73011716", 
  // locationObjectId of the survey
  "locationObjectId": {
    "$oid": "69025e5417e57c561a3bba0e"
  },
  // isFallback is true, so that the research team knows this seed was generated from the app
  "isFallback": true,
  // created datetime
  "createdAt": {
    "$date": "<created date time>"
  }
}
  1. Survey document then looks like the following:
{
  // generated by MongoDB on insertion
  "_id": {
    "$oid": "some-random-string-we-dont-care-about"
  },
  // same as surveyCode in the above seed document
  "surveyCode": "73011716",
  "parentSurveyCode": "__SEED__",
  // 3 unique child survey codes that do not exist in the database
  "childSurveyCodes": [
    "272CC45A",
    "54A1B18A",
    "721C442A"
  ],
  "responses": {
    // survey responses
    ...
  },
  "createdByUserObjectId": {
    "$oid": "object id of the user document that created the survey"
  },
  // other survey properties
  "locationObjectId": {
    ...
  },
  ...
}

Option 2: Enter / Scan Referral Code and Scanned Code is Seed Code

  1. Create a survey document:
"surveyCode": "scanned referral code / also == to surveyCode in the seed document / isFallBack property of the seed document will be false ",
"parentSurveyCode": "__SEED__",
// location object id where the survey is being entered and not the location of the seed document
"locationObjectId": {}
// Other properties as above.
...

Option 3: Enter / Scan Referral Code and Scanned Code is a Child Survey Code

  1. Create a survey document:
"surveyCode": "scanned referral code / also exists in childSurveyCodes property of a survey document that we now call parent",
"parentSurveyCode": "surveyCode of the parent survey",
// location object id where the survey is being entered, and not the location of the seed document
"locationObjectId": {}
// Other properties as above.
...