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

Definition based extraction: Issue in the extension url using ProfileLoader

Open vbothe23 opened this issue 1 year ago • 1 comments

Describe the bug When using structure-definition-based-extraction with ProfileLoader, the extension URL in the resource should be same as it's profile URL, rather than the definition URL mentioned in the Questionnaire.

Component SDC library

To Reproduce Steps to reproduce the behavior:

  1. Use below json as a questionnaire string.
{
         "resourceType": "Questionnaire",
         "extension": [
           {
             "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemExtractionContext",
             "valueExpression": {
               "language": "application/x-fhir-query",
               "expression": "Patient",
               "name": "patient"
             }
           }
         ],
         "item": [
           {
             "linkId": "1",
             "definition": "http://fhir.org/guides/who/core/StructureDefinition/who-patient#Patient.birthTime",
             "text": "Time of birth",
             "type": "dateTime"
           }
         ]
       }
  1. Use below json as a questionnaireResponse string.
{
          "resourceType": "QuestionnaireResponse",
          "item": [
            {
              "linkId": "1",
              "answer": [
                {
                  "valueDateTime": "2022-02-07T13:28:17-05:00"
                }
              ]
            }
          ]
        }
  1. Perform extraction using profileLoader.
ResourceMapper.extract(
        questionnaire = questionnaireWithBirthTimeExt,
        questionnaireResponse = questionnaireResponseWithBirthTimeExt,
        profileLoader = ProfileLoaderImplWithExt(mContext),
      )

Profile for Patient Birth-time extension

{
        "id": "Patient.extension:birthTime",
        "path": "Patient.extension",
        "sliceName": "birthTime",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/patient-birthTime"
            ]
          }
        ],
        "mustSupport": true
      }

Expected behavior Extracted Patient resource should contain the extension with URL http://hl7.org/fhir/StructureDefinition/patient-birthTime But URL in the extension is http://fhir.org/guides/who/core/StructureDefinition/who-patient#Patient.birthTime

Additional context https://fhir-ru.github.io/extension-patient-birthtime.html

vbothe23 avatar Jun 08 '23 06:06 vbothe23

https://hl7.org/fhir/R4B/extension-patient-birthtime.html

dubdabasoduba avatar Feb 21 '24 07:02 dubdabasoduba