android-fhir
android-fhir copied to clipboard
Definition based extraction: Issue in the extension url using ProfileLoader
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:
- 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"
}
]
}
- Use below json as a questionnaireResponse string.
{
"resourceType": "QuestionnaireResponse",
"item": [
{
"linkId": "1",
"answer": [
{
"valueDateTime": "2022-02-07T13:28:17-05:00"
}
]
}
]
}
- 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
https://hl7.org/fhir/R4B/extension-patient-birthtime.html