@refinio/one.models
    Preparing search index...

    This model represents everything related to Questionnaires.

    At the moment this model is just managing questionnaire responses. In the future this will most probably also manage questionnaires.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    onIncompleteResponse: OEvent<() => void> = ...

    Event is emitted when the incomplete questionnaire response data is updated.

    onUpdated: OEvent<(timeOfEarliestChange: Date) => void> = ...
    state: StateMachine<"Uninitialised" | "Initialised", "shutdown" | "init">
    channelId: "questionnaireResponse" = 'questionnaireResponse'

    Methods

    • Check if incomplete questionnaires exists.

      Parameters

      • type: string

        The type of the incomplete response collection.

      • Optionalsince: Date

        Not older than this date.

      Returns Promise<boolean>

    • Checks whether a questionnaire exists.

      Parameters

      • name: string

        Name of the questionnaire

      • Optionallanguage: string

        Language of questionnaire. If empty, just check in any language.

      Returns Promise<boolean>

    • Checks whether a questionnaire exists.

      Parameters

      • url: string

        Url of the questionnaire

      Returns Promise<boolean>

    • Initialize this instance

      This must be done after the one instance was initialized.

      Returns Promise<void>

    • Marks an incomplete response as complete.

      Note: This simply posts an empty responses object to the incomplete channel.

      Parameters

      • type: string

        The type of the incomplete response collection.

      Returns Promise<void>

    • Saving incomplete questionnaires.

      Parameters

      • response: QuestionnaireResponse_2_0_0

        The incomplete response.

      • type: string

        The type of the response. This is later used to find incomplete responses.

      • Optionalname: string

        The name of the response

      Returns Promise<void>

    • Save incomplete questionnaire collection.

      Parameters

      • responses: QuestionnaireResponse_2_0_0[]

        The response list. If this list is empty then it works exactly as markIncompleteResponseAsComplete.

      • type: string

        The type of the response. This is later used to find incomplete responses.

      • Optionalname: string

        The name of the response

      Returns Promise<void>

    • Create a new response to a questionnaire

      Parameters

      • response: QuestionnaireResponse_2_0_0

        The questionnaire response to post

      • Optionalname: string

        The name for this collection. This could be something the user specifies in order to be identified easily.

      • Optionaltype: string

        An application specific type. It is up to the application what to do with it.

      • Optionalowner: SHA256IdHash<Person>

        Change the owner of the channel to post to. Defaults to the default channel person that is set in the channel manager.

      Returns Promise<SHA256Hash<QuestionnaireResponses_2_0_0>>

    • Post multiple responses as a single collection.

      This means that later when querying the questionnaires, this collection will appear as single entry. This is useful if you dynamically compose a big questionnaires from several partial questionnaires.

      Parameters

      • responses: QuestionnaireResponse_2_0_0[]

        The list of questionnaire responses to post

      • Optionalname: string

        The name for this collection. This could be something the user specifies in order to be identified easily.

      • Optionaltype: string

        An application specific type. It is up to the application what to do with it.

      • Optionalowner: SHA256IdHash<Person>

        Change the owner of the channel to post to. Defaults to the default channel person that is set in the channel manager.

      Returns Promise<SHA256Hash<QuestionnaireResponses_2_0_0>>

    • Get a specific questionnaire

      Parameters

      • name: string

        The name of the questionnaire

      • Optionallanguage: string

        Language of questionnaire. If empty, just return the first in any language.

      Returns Promise<Questionnaire>

    • Get a specific questionnaire

      Note that this does not connect to the server behind the url. The url is simply the id used by questionnaires. FHIR uses urls for identifying resources such as questionnaires.

      Parameters

      • url: string

        The url of the questionnaire

      Returns Promise<Questionnaire>

    • Get a questionnaire url by name and language.

      Parameters

      • name: string
      • Optionallanguage: string

      Returns Promise<string>

    • Adding questionnaires to the available questionnaires list.

      Note: In the future questionnaires will be served by one as one objects. This function will then change or be removed.

      Parameters

      • questionnaires: Questionnaire[]

        The list of the questionnaires that will be added

      Returns void