Question Content Type Data Model
Description
Surveys are made up of questions and each question is represented by a form component. In a question's data model (COTQuestions), the form component type is indicated by the Question Content Type.
The COTQuestionContentType is also used on survey answers within the COTAnswerData model.
Content Types
On each content type card displayed below, a content type code, data type, and description are indicated.
- Content Type Code: Corresponds to the system code used to indicate the question content type.
- Answer Data Type: Indicates the input type and format the question field handles. For example, the Text Number content type used for rating components processes number values. Submitted answers are found in the
answers.data.process
field. - Description: Indicates the related survey component and other uses.
Text
Content Type Code: application/vnd.cotalker.survey+text
Description: Used for text components and COTQuestions that represent the field labels displayed in the survey form.
Answer Data Type: Any characters. Example: Hello world!
Text Input
Content Type Code: application/vnd.cotalker.survey+textinput
Description: Indicates a written answer component.
Answer Data Type: Any characters. Example: Hello world!
- QR or NFC inputs can be used with the text input content type. In those cases, the following fields are used in the COTQuestion model:
QR & NFC Fields
Field | Description | Type | Required | Notes |
---|---|---|---|---|
code | Code depends on the content type. Below is the code for scanning QR & NFC in surveys. | string[ ] | Required | Objects within the array must be written in string format. |
code[index].scan | object | Required | ||
code[index].scan.enabled | true activates the feature. | boolean | Required | |
code[index].scan.source | Indicates the input source. | string[ ] | Required | Valid options: qr and/or nfc . |
code[index].scan.force | true allows only QR Code or NFC input. false permits manual text input, also. | boolean | Required | |
contentType | Indicates how the system should interpret the data. | string | Required | Must be set to: application/vnd.cotalker.survey+textinput |
identifier | Unique identification name | string | Required | Maximum 60 characters; only lowercase letters, numbers, and underscore allowed; must be unique. |
JSON Sample
Text Input with QR and NFC inputs:
{
"code": [
"{\"scan\":{\"enabled\":true,\"source\":[\"qr\",\"nfc\"],\"force\":true}}"
],
"identifier": "qr_test",
"contentType": "application/vnd.cotalker.survey+textinput",
...
}
Text Number
Content Type Code: application/vnd.cotalker.survey+textnumber
Description: Used on rating components for evaluating with a five-star system.
Answer Data Type: Number. Example: 5
Date Time
Content Type Code: application/vnd.cotalker.survey+datetime
Description: Indicates the date and time component used to choose a date and time from a pop-up calendar and clock.
Answer Data Type: Number in Unix Epoch time format. Example: 1654895560
List Question
Content Type Code: application/vnd.cotalker.survey+listquestion
Description: Indicates the multiple choice component item list type used to choose items from a list made during survey setup.
Answer Data Type: Array of "values" of the selected options, i.e., the value assigned to the item. See the list of items type for further details. Example: ["value1", "value2"]
Property
Content Type Code: application/vnd.cotalker.survey+property
Description: Corresponds to a multiple choice component collection type used to provide the elements of the indicated collection as options.
Answer Data Type: ObjectId<COTProperty> array. Example: ["6185cfe1ef46d0aee4c2b653", "6185cfe8b420610501b280d8"]
Person
Content Type Code: application/vnd.cotalker.survey+person
Description: Indicates the multiple choice component users type to choose among users.
Answer Data Type: ObjectId<COTUsers> array. Example: ["611a7d2f174df70491261623", "611a7d54f13f3d03e631f990"]
API
Content Type Code: application/vnd.cotalker.survey+api
Description: Indicates the multiple choice component API type that permits gathering data through API request.
Answer Data Type: Varies.
GPS
Content Type Code: application/vnd.cotalker.survey+gps
Description: Refers to the location component that returns GPS coordinates displayed on an embedded Google Map.
Answer Data Type: Latitud and longitude array. Example: ["-33.0419355", "-71.4323595"]
When this content type is used, the following fields are used in COTQuestion model:
Fields
Field | Description | Type | Required | Notes |
---|---|---|---|---|
code | Contains special component details | string[ ] | Required | Objects within the array must be written in string format. |
code[x].type | Indicates the map type. | string | Required | Available options: currentLocation , freeLocation |
display | Indicates the map button label within the survey form. | string[ ] | Required | |
contentType | Sets the form component type. For maps, it must be set to application/vnd.cotalker.survey+gps . | string | Required | |
identifier | Indicates the components identification code. | string | Required | Can only contain lowercase letters, underscores, and numbers. Must begin with a letter. |
JSON Sample
{
"display": [
"Choose Map Location"
],
"code": [
"{\"type\":\"freeLocation\"}"
],
"contentType": "application/vnd.cotalker.survey+gps",
...
}
Image
Content Type Code: application/vnd.cotalker.survey+image
Description: Refers to the camera component to get photos from a device's camera or gallery.
Answer Data Type: URL of file uploaded to Cotalker server.
Signature
Content Type Code: application/vnd.cotalker.survey+signature
Description: Indicates a signature component to capture a hand or mouse written drawing.
Answer Data Type: Captured signature image code.
File
Content Type Code: application/vnd.cotalker.survey+file
Description: Used to indicate the attachment component when sharing files or notes.
Answer Data Type: URL of uploaded file or note.
Survey
Content Type Code: application/vnd.cotalker.survey+survey
Description: The survey component is used when embedding a survey into the survey.
Answer Data Type: Object which includes answer.uuid
, survey._id
, and survey.code
. The data within the object must be in string format. Example: "{\"uuids\":[\"62a4730d71d581cb11c5197c\"],\"survey\":\"62a473166e323e750390b2de\",\"code\":\"location_list_00\"}"