Skip to content
J Delaney edited this page Feb 11, 2015 · 18 revisions

Schema Definition

businesses

  • companyName: String
  • username: String
  • password: String
  • email: String
  • phone: String
  • logo: String path to image file
  • walkins: Boolean

employees

  • business: ObjectId
  • email: String
  • fname: String (optional)
  • lname: String (optional)
  • password: String
  • 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
  • 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. 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: "textbox",
                    label: "Name"
            },
            {
                    type: "dropdown",
                    label: "Gender",
                    options: ["Male", "Female"]
            },
            {
                    type: "textbox",
                    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