microsoft / microsoft/fhir-server
Chained search not evaluated in contained resources
- Dominant language
- TSQL
- Stars
- 1.4k
- Forks
- 592
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 41
Description
**Describe the bug**
According to spec, chained searched should should be evaluated in contained resources (https://www.hl7.org/fhir/search.html#contained). This does not work.
**To Reproduce**
Steps to reproduce the behavior:
1. Provision server with SQL backend.
2. Upsert the following `MedicationRequest`
```
{
"resourceType": "MedicationRequest",
"id": "medrx0316",
"text": {
"status": "generated",
"div": "
Generated Narrative with Details
id: medrx0316
contained:
identifier: 12345689 (OFFICIAL)
status: completed
intent: order
medication: id: med0306; Adcetris (Details : {http://hl7.org/fhir/sid/ndc code '51144-050-01' = 'n/a', given as 'Adcetris'}); Lyophilized powder for injectable solution (qualifier value) (Details : {SNOMED CT code '421637006' = 'Lyophilised powder for injectable solution', given as 'Lyophilized powder for injectable solution (qualifier value) '})
subject: Donald Duck
encounter: encounter who leads to this prescription
authoredOn: 15/01/2015
requester: Patrick Pump
instantiatesUri: http://www.bccancer.bc.ca/chemotherapy-protocols-site/Documents/Lymphoma-Myeloma/ULYBRENTUX%20Protocol_1Jun2017.pdf
dosageInstruction:
},
"contained": [
{
"resourceType": "Medication",
"id": "med0306",
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/sid/ndc",
"code": "51144-050-01",
"display": "Adcetris"
}
]
},
"form": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "421637006",
"display": "Lyophilized powder for injectable solution (qualifier value) "
}
]
},
"batch": {
"lotNumber": "12345",
"expirationDate": "2019-10-31"
}
}
],
"identifier": [
{
"use": "official",
"system": "http://www.bmc.nl/portal/prescriptions",
"value": "12345689"
}
],
"status": "completed",
"intent": "order",
"medicationReference": {
"reference": "#med0306"
},
"subject": {
"reference": "Patient/pat1",
"display": "Donald Duck"
},
"encounter": {
"reference": "Encounter/f001",
"display": "encounter who leads to this prescription"
},
"authoredOn": "2015-01-15",
"requester": {
"reference": "Practitioner/f007",
"display": "Patrick Pump"
},
"instantiatesUri": [
"http://www.bccancer.bc.ca/chemotherapy-protocols-site/Documents/Lymphoma-Myeloma/ULYBRENTUX%20Protocol_1Jun2017.pdf"
],
"dosageInstruction": [
{
"sequence": 1,
"text": "1.8 mg/kg IV infusion over 20 minutes every 3 weeks for 16 cycles",
"timing": {
"repeat": {
"count": 16,
"frequency": 1,
"period": 3,
"periodUnit": "wk"
}
},
"route": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "255560000",
"display": "Intravenous"
}
]
},
"doseAndRate": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/dose-rate-type",
"code": "ordered",
"display": "Ordered"
}
]
},
"doseQuantity": {
"value": 1.8,
"unit": "mg/kg",
"system": "http://unitsofmeasure.org",
"code": "mg/kg"
},
"rateRatio": {
"numerator": {
"value": 1.8,
"system": "http://unitsofmeasure.org",
"code": "mg/kg"
},
"denominator": {
"value": 20,
"system": "http://unitsofmeasure.org",
"code": "min"
}
}
}
],
"maxDosePerLifetime": {
"value": 400,
"unit": "mg",
"system": "http://unitsofmeasure.org",
"code": "mg"
}
}
]
}
```
3. Search for `/MedicationRequest?medication.ingredient-code=51144-050-01`
**Expected behavior**
Search above should return the `MedicationRequest`
**Actual behavior**
Search is empty.
Contributor guide
Assessment
This issue has not been assessed yet.