Endpoints

What are Questionnaire Templates?

A basic FHIR concept is the use of so called Careplan templates that we will provide on forehand. These Templates are developed on our side (by our developers).

Questionnaire task

Please note that each questionnaire should start with a questionnaire task. This task could be scheduled, repeated or filled (states). Without this task nothing will happen.. :-)

To schedule a Questionnaire target POST endpoint /patient/{userId}/questionnaire-task
This will create a task for each time a Questionnaire needs to be submitted. So basically, Questionnaire scheduling can be looked in the same way as Task creation.
Patient in the path url is a person who does the job of filling in the Questionnaire.
The payload needed is an object with attributes:

  • questionnaireIds - list of the Questionnaire ids
  • carePlanIds - list of the Care Plan ids (not used for now)
  • subjectId - id of a user who provides the answers
  • description - description given with Questionnaire scheduling
  • fulfilmentSought - is an object defining restrictions on when fulfilment of the Questionnaire is sought, with attributes:
    • type - what kind is restriction, with allowed values SINGLE and RECURRING; when SINGLE, Questionnaire will be submitted once, and only deadline is requested, where deadline is set as to attribute; and when RECURRING, a Questionnaire can be scheduled for example "every 3 months from 01.01.2020. to 01.01.2021." and that would require Questionnaire to be submitted 4 times
    • intervalAmount - in the example "every 3 months from 01.01.2020. to 01.01.2021.", interval amount represents number 3
    • intervalPrecision - in the example "every 3 months from 01.01.2021. to 01.01.2020.", interval precision represents value months; allowed values are YEAR, MONTH, DAY
    • from - date
    • to - date: if type is SINGLE, only "to" attribute is required, otherwise all attributes are required

List of Questionnaires tasks

Target GET endpoint /patient/{userId}/questionnaire-task

Allowed parameters are:

  • for sorting and paging parameters please check "List of Questionnaire templates" section; the only difference is in the allowed sorting attribute, here it is "STATUS"
  • status - serves as a filter on status field
  • Response is a list of objects with attributes:
  • taskId - id of a Task
  • questionnaireId - id of a Questionnaire
  • questionnaireTitle - Questionnaire name
  • tags - a list of tags related to the Questionnaire
  • copyright - information about he Questionnaire copyright
  • deadline - date until Questionnaire should be submitted
  • status - one of the statuses:
    • REQUESTED means that questionnaire is scheduled / task is created,
    • FAILED means that that the questionnaire reference is unavailable
    • REJECTED is set through the api endpoint (not yet available)
    • IN_PROGRESS is set through the api endpoint (not yet available)
    • COMPLETED means that Questionnaire response has been submitted by the user
    • DELETE means that task is deleted

Get details of a single questionnaire task

Target GET endpoint /patient/{userId}/questionnaire-task/{taskId}

Response is an object which contains all attributes like the one in "List of scheduled Questionnaires / questionnaire tasks" section. In addition it contains following attribute:
description - text

Delete questionnaire task/s

Target DELETE endpoint /patient/{userId}/questionnaire-task/{taskId}/{selection}

selection - can be one of the following SINGLE, FOLLOWING, ALL; where when provided value SINGLE only that specific task will be deleted; when provided value ALL, that task will be deleted, and all other tasks from the same group (task group is when Questionnaire is scheduled with option RECURRING, and then multiple tasks are created at the same time - they all belong to the same group); and when FOLLOWING is provided, that task will be deleted, and all tasks from the group that have deadline which is after the deadline of provided task

Edit questionnaire task/s

Target PUT endpoint /owner/{ownerId}/questionnaire-task/{taskId}/{selection}

selection - can be one of the following SINGLE, FOLLOWING, ALL; where when provided value SINGLE only that specific task will be updated; ALL and FOLLOWING is not supported yet

For information about the payload, please check "Schedule a Questionnaire" section, as the payloads are the same.

List of Questionnaire templates

To get the list of Questionnaire templates, target GET endpoint: /patient/{userId}/questionnaire

Allowed parameters are:

  • sort - defines what to sort on, and for now only value available is "TITLE"
  • mode - defines the sort direction, and values available are ASC and DESC
  • start - is a number used for paging, it defines index of the first element that we want to fetch from whole list (if start is provided, count has to be provided as well)
  • count - is a number used for paging, and in combination with start it defines how many elements to fetch from the start one (if count is provided, start has to be provided as well)

Response is a list of objects with attributes:

  • resourceId - id of a Questionnaire
  • title - Questionnaire name
  • tags - a list of tags related to the Questionnaire
  • copyright - information about the Questionnaire copyright

Count of Questionnaire templates

Target GET endpoint /patient/{userId}/questionnaire/count without any parameters to get the count (as a number) of all Questionnaire templates. As list endpoint doesn't receive any filter parameters, there are no such filters for count endpoint as well.

Language settings

Based on the language settings created for each user the Questionnaires will be created in that specific language.

Get details of a single Questionnaire template

Target GET endpoint /patient/{userId}/questionnaire/{questionnaireId}

Response is an object called QuestionnairePayload, which is the same as for MedMij Questionnaires feature.