Skip to content
ktoribio edited this page Mar 9, 2015 · 18 revisions

Schema Definition

Note that every document has a unique field called _id used to identify it.

businesses

  • companyName: String
  • username: String
  • password: String
  • email: String
  • phone: String
  • disclosure: String
  • logo: String (optional) path to image file
  • walkins: Boolean

mobileTokens

  • business: ObjectId
  • employee: ObjectId Employee who authorized this device
  • name: String

Note: The _id acts as the auth token

employees

  • business: ObjectId
  • email: String
  • fname: String (optional)
  • lname: String (optional)
  • password: String
  • phone: String Format is 1234567890, does not include dashes.
  • smsNotify: Boolean
  • emailNotify: Boolean
  • registerToken: String (optional) When a business first adds an employee a token is generated for them. They're sent a link with this token attached to it.

appointments

  • business: ObjectId
  • employee: ObjectId
  • date: Date
  • fname: String
  • lname: String
  • dob: String (must be in MM/DD/YYYY format. If user inputs single digit MM or DD, 0 will be added for them)
  • email: String
  • state: String see states for possible values
  • confirmationCode: String

states

  1. scheduled: The person has an appointment in the future but has not yet shown up in the office.
  2. formDone: The person has completed the custom form by the office and only needs a signature to finish checking in.
  3. checkedIn: The person has finished the custom form by the office and has signed the disclosure agreement. Their form response can now be viewed and they are ready to be roomed.
  4. roomed: The patient is now in a room.
  5. done: The patient's appointment is over. After this point, we don't really care about them.

forms

  • business: ObjectId
  • fields: [fieldObject] an array of embedded documents following the fieldObject schema specified below. Order of the array reflects order of the fields.

fieldObject

  • type: String can be either "textfield" or "dropdown"
  • label: String
  • options: [String] (optional) Only for "dropdown" fields. The list of options for the dropdown.

formResponses

  • employee: ObjectId
  • appointment: ObjectId
  • answers: [answerObject] an array of embedded documents following the `answerObject schema specified below. Order of the array reflects order of the fields.

answerObject

  • label: String
  • response: String

Form Examples

Since the forms and formResponses collection are a bit complex here is an example to help clarify. Pretend we are trying to encode the form shown here. The form collection would look like:

{
    business: ObjectId("948943204910"),
    fields: [
            {
                    type: "textfield",
                    label: "Name"
            },
            {
                    type: "dropdown",
                    label: "Gender",
                    options: ["Male", "Female"]
            },
            {
                    type: "textfield",
                    label: "Email"
            },
            {
                    type: "dropdown",
                    label: "Favorite Color",
                    options: ["Blue", "Yellow", "Green", "Pink"]
            }
    ]
}

An example response would look like:

{
    employee: ObjectId("9585938934"),
    appointment: ObjectId("438398498294"),
    answers: [
        {
            label: "Name",
            response: "John Doe"
        },
        {
            label: "Gender",
            response: "Female"
        },
        {
            label: "Email",
            response: "john.doe@example.com"
        },
        {
            label: "Favorite Color",
            response: "Blue"
        }
    ]
}
Clone this wiki locally