android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Ability to Capture Questionnaire Launch and Submit Timestamps

Open qiarie opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe. We would like to track how long it takes agents in the field to fill out questionnaires. This is for process auditing purposes and to be able to optimise data collection activities and processes.

Describe the solution you'd like

  • Capture the timestamp of when a questionnaire is launched.
  • Capture the timestamp of when a questionnaire is submitted.
  • The timestamps can then be loaded to the questionnaire response for processing post-submit.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Would you like to work on the issue? Please state if this issue should be assigned to you or who you think could help to solve this issue.

qiarie avatar Dec 15 '23 06:12 qiarie

@jingtang10 do you mind looking into this?

dubdabasoduba avatar Dec 15 '23 17:12 dubdabasoduba

@f-odhiambo cc: @jingtang10 I am picking up this ticket. As discussed I'll be adding two items to QuestionnaireResponse, questionnaire-launch-time and questionnaire-submission-time

hamza-vd avatar Dec 28 '23 14:12 hamza-vd

@f-odhiambo cc: @jingtang10 @qiarie

After some discussion and scoping, the following enhancements will be implemented:

  1. Both QuestionnaireResponseItemComponent and QuestionnaireItemComponent will be included at both the launch and submission stages. A sample QuestionnaireResponseItemComponent is illustrated below:
QuestionnaireResponseItemComponent().apply {
    linkId = "submission-timestamp"
    answer = arrayListOf<QuestionnaireResponseItemAnswerComponent?>().apply {
        add(QuestionnaireResponseItemAnswerComponent().apply {
            value = StringType("<timestamp>")
        })
    }
}

  1. The introduced functionality will be configurable.

hamza-vd avatar Jan 03 '24 09:01 hamza-vd

A sample QR will look like

{
  "resourceType": "QuestionnaireResponse",
  "item": [
    {
      "linkId": "1",
      "text": "Choose one from the options below",
      "answer": [
        {
          "valueCoding": {
            "code": "option-1",
            "display": "Option 1"
          },
          "item": [
            {
              "linkId": "1-select-one",
              "text": "Select one"
            }
          ]
        }
      ]
    },
    {
      "linkId": "launch-timestamp",
      "answer": [
        {
          "valueString": "2024-01-04T11:39:30.040+05:00"
        }
      ]
    },
    {
      "linkId": "submission-timestamp",
      "answer": [
        {
          "valueString": "2024-01-04T11:41:01.095+05:00"
        }
      ]
    }
  ]
}

hamza-vd avatar Jan 04 '24 06:01 hamza-vd

As per the PR comments, there will be a change in the implementation. I will implement the following changes.

  1. The authored field will be used as a submission timestamp.
  2. The launch-timestamp will be added as an extension to the QuestionnaireResponse.

hamza-vd avatar Feb 21 '24 12:02 hamza-vd

A new sample implementation

{
  "resourceType": "QuestionnaireResponse",
  "extension": [
    {
      "urI": "launch-timestamp",
      "valueDateTime'": "2024-02-22T15:25:29+05:00"
    }
  ],
  "authored": "2024-02-22715:25:32+05:00",
  "item": []
}

hamza-vd avatar Feb 22 '24 10:02 hamza-vd

thanks for creating this discussion @hamza-vd: https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/Ability.20to.20Capture.20Questionnaire.20Launch.20and.20Submit.20Timestamp

jingtang10 avatar Mar 27 '24 16:03 jingtang10