Django Rest multilevel nested POST data in serializer - django-rest-framework

I have nested JSON data like below:
{
"resourceType": "Patient",
"identifier": [{
"use": "usual",
"type": {
"coding": [{
"code": "MR",
"display": "Medical Record Number"
}],
"text": "Medical Record Number"
},
"system": "http://example.com",
"value": "1032702",
"assigner": {
"reference": "Organization/198723168",
"display": "Reference Organization",
"data": {
"resourceType": "Organization",
"implicitRules": "",
"language": "",
"contained": "",
"extension": "",
"alias": "",
"contact": "",
"modifierExtension": "",
"active": true,
"name": "Clinic",
"address": [{
"line": [
"3300 Washtenaw Avenue, Suite 227"
],
"city": "Amherst",
"state": "MA",
"postalCode": "01002",
"country": "USA"
}]
}
}
}]
}
In serializers create method, I want to get the data which is nested to identifier->assigner and store that in organization serializer which different than this to which I am POSTing these data. For top level data I can do like validated_data.pop('identifier'). Is there a similar way for nested one?

Related

FHIR: Not finding DiagnosticReport for patient id on SmartHealthIt server

I'm trying to find DiagnosticReport resources for a given patient using the SmartHealthIt R4 server for testing (https://r4.smarthealthit.org).
I've loaded the Patient and DiagnosticReport resources shown below.
The patient has the following for id:
"resourceType": "Patient",
"id": "1435573",
The DiagnosticReport has the following for subject:
"subject": {
"reference": "Patient/1435573"
}
None of the following searches return this DiagnosticReport. How do I get all of the DiagnosticReport resources for Patient/1435573 including the one used in this example (I can modify the Patient, the DiagnosticReport, and/or the urls to get the result). The queries below are based on Hapi FHIR: searching for patient identifier using Postman. All of the queries give basically an empty bundle (contains only the self url) except for the last that gives an invalid query error.
Queries:
https://r4.smarthealthit.org/DiagnosticReport?subject=1435573
https://r4.smarthealthit.org/DiagnosticReport?patient.identifier=1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=https://r4.smarthealthit.org/Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject=http://r4.smarthealthit.org/Patient/1435573
https://r4.smarthealthit.org/DiagnosticReport?subject.reference=1435573
(invalid parameter chain error)
Full Patient Resource (response from the url shown below):
https://r4.smarthealthit.org/Patient/1435573
{
"resourceType": "Patient",
"id": "1435573",
"meta": {
"versionId": "1",
"lastUpdated": "2022-11-20T12:31:20.724-05:00",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by Synthea.Version identifier: master-branch-latest\n . Person seed: -3481236467670898486 Population seed: 1663786624475</div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
}
},
{
"url": "text",
"valueString": "White"
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
},
{
"url": "text",
"valueString": "Not Hispanic or Latino"
}
]
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
"valueString": "Natosha194 Rolfson709"
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
"valueCode": "M"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"city": "Westfield",
"state": "Massachusetts",
"country": "US"
}
},
{
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years",
"valueDecimal": 0.011850126818590398
},
{
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years",
"valueDecimal": 30.98814987318141
}
],
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
],
"text": "Medical Record Number"
},
"system": "http://hospital.smarthealthit.org",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}
],
"text": "Social Security Number"
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "999-55-2948"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}
],
"text": "Driver's License"
},
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"value": "S99934182"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}
],
"text": "Passport Number"
},
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"value": "X1908681X"
}
],
"name": [
{
"use": "official",
"family": "Hermiston71",
"given": [
"Glenn0",
"Adalberto916"
],
"prefix": [
"Mr."
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-370-8941",
"use": "home"
}
],
"gender": "male",
"birthDate": "1960-07-09",
"deceasedDateTime": "1992-06-21T18:48:35-04:00",
"address": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/geolocation",
"extension": [
{
"url": "latitude",
"valueDecimal": 42.1419070399434
},
{
"url": "longitude",
"valueDecimal": -71.28041093915812
}
]
}
],
"line": [
"236 Halvorson Mews Suite 21"
],
"city": "Walpole",
"state": "MA",
"country": "US"
}
],
"maritalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}
],
"text": "M"
},
"multipleBirthBoolean": false,
"communication": [
{
"language": {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}
],
"text": "English"
}
}
]
}
Full DiagnosticReport Resource (response from the url shown below):
https://r4.smarthealthit.org/DiagnosticReport/1435574
{
"resourceType": "DiagnosticReport",
"id": "1435574",
"meta": {
"versionId": "1",
"lastUpdated": "2022-11-20T12:36:53.205-05:00",
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note"
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]
},
"subject": {
"reference": "Patient/1435573"
},
"effectiveDateTime": "1978-09-02T17:57:46-04:00",
"issued": "1978-09-02T17:57:46.296-04:00",
"performer": [
{
"display": "Dr. Debbie941 Macejkovic424"
}
],
"presentedForm": [
{
"contentType": "text/plain; charset=utf-8",
"data": "DQoxOTc4LTA5LTAyDQoNCiMgQ2hpZWYgQ29tcGxhaW50DQpObyBjb21wbGFpbnRzLg0KDQojIEhpc3Rvcnkgb2YgUHJlc2VudCBJbGxuZXNzDQpHbGVubjANCiBpcyBhIDE4IHllYXItb2xkIG5vbi1oaXNwYW5pYyB3aGl0ZSBtYWxlLg0KDQojIFNvY2lhbCBIaXN0b3J5DQogUGF0aWVudCBoYXMgbmV2ZXIgc21va2VkLg0KIFBhdGllbnQgaWRlbnRpZmllcyBhcyBoZXRlcm9zZXh1YWwuDQoNClBhdGllbnQgY29tZXMgZnJvbSBhIG1pZGRsZSBzb2Npb2Vjb25vbWljIGJhY2tncm91bmQuDQogUGF0aWVudCBkaWQgbm90IGZpbmlzaCBoaWdoIHNjaG9vbC4NClBhdGllbnQgY3VycmVudGx5IGhhcyBCbHVlIENyb3NzIEJsdWUgU2hpZWxkLg0KDQojIEFsbGVyZ2llcw0KTm8gS25vd24gQWxsZXJnaWVzLg0KDQojIE1lZGljYXRpb25zDQpObyBBY3RpdmUgTWVkaWNhdGlvbnMuDQoNCiMgQXNzZXNzbWVudCBhbmQgUGxhbg0KUGF0aWVudCBpcyBwcmVzZW50aW5nIHdpdGggaG91c2luZyB1bnNhdGlzZmFjdG9yeSAoZmluZGluZyksIG9ubHkgcmVjZWl2ZWQgcHJpbWFyeSBzY2hvb2wgZWR1Y2F0aW9uIChmaW5kaW5nKSwgZnVsbC10aW1lIGVtcGxveW1lbnQgKGZpbmRpbmcpLCBzb2NpYWwgaXNvbGF0aW9uIChmaW5kaW5nKSwgc3RyZXNzIChmaW5kaW5nKS4gDQoNCiMjIFBsYW4NCg0K"
}
]
}
--- EDIT ---------------------------------------
This query (suggested in answer below) also does not work. Screen shots are for a newly create patient (the original was deleted).
https://r4.smarthealthit.org/DiagnosticReport?patient=1437050
--- EDIT: STEPS TO REPRODUCE ---------------------------------
It looks like the patients created by end users are routinely deleted from this server (which makes sense). Here are the steps to reproduce the issue.
POST this messge to https://launch.smarthealthit.org/v/r4/fhir/Patient
{
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"system": "http://hospital.smarthealthit.org",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}],
"text": "Medical Record Number"
},
"value": "d7e5852a-974c-6d45-f81d-5a87bbd05d2a"
},
{
"system": "http://hl7.org/fhir/sid/us-ssn",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}],
"text": "Social Security Number"
},
"value": "999-55-2948"
},
{
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}],
"text": "Driver's License"
},
"value": "S99934182"
},
{
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"type": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}],
"text": "Passport Number"
},
"value": "X1908681X"
}
],
"extension": [
{
"extension": [
{
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
},
"url": "ombCategory"
},
{
"valueString": "White",
"url": "text"
}
],
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
},
{
"extension": [
{
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
},
"url": "ombCategory"
},
{
"valueString": "Not Hispanic or Latino",
"url": "text"
}
],
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
},
{
"valueString": "Natosha194 Rolfson709",
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName"
},
{
"valueCode": "M",
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
},
{
"valueAddress": {
"country": "US",
"city": "Westfield",
"state": "Massachusetts"
},
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace"
},
{
"valueDecimal": 0.011850126818590398,
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years"
},
{
"valueDecimal": 30.98814987318141,
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years"
}
],
"address": [{
"country": "US",
"extension": [{
"extension": [
{
"valueDecimal": 42.1419070399434,
"url": "latitude"
},
{
"valueDecimal": -71.28041093915812,
"url": "longitude"
}
],
"url": "http://hl7.org/fhir/StructureDefinition/geolocation"
}],
"city": "Walpole",
"line": ["236 Halvorson Mews Suite 21"],
"state": "MA"
}],
"gender": "male",
"multipleBirthBoolean": false,
"birthDate": "1960-07-09",
"meta": {"profile": ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"]},
"deceasedDateTime": "1992-06-21T18:48:35-04:00",
"name": [{
"given": [
"Glenn0",
"Adalberto916"
],
"use": "official",
"prefix": ["Mr."],
"family": "Hermiston71"
}],
"telecom": [{
"system": "phone",
"use": "home",
"value": "555-370-8941"
}],
"text": {
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by <a href=\"https://github.com/synthetichealth/synthea\">Synthea<\/a>.Version identifier: master-branch-latest\n . Person seed: -3481236467670898486 Population seed: 1663786624475<\/div>",
"status": "generated"
},
"communication": [{"language": {
"coding": [{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}],
"text": "English"
}}],
"maritalStatus": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}],
"text": "M"
},
"resourceType": "Patient"
}
Modify this message by replacing PATIENT_ID with the id returned when the Patient resource is posted and then post that to https://launch.smarthealthit.org/v/r4/fhir/DiagnosticReport
{
"code": {"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]},
"performer": [{
"display": "Dr. Debbie941 Macejkovic424"
}],
"effectiveDateTime": "1978-09-02T17:57:46-04:00",
"meta": {"profile": ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note"]},
"subject": {"reference": "https://r4.smarthealthit.org/Patient/PATIENT_ID"},
"presentedForm": [{
"data": "DQoxOTc4LTA5LTAyDQoNCiMgQ2hpZWYgQ29tcGxhaW50DQpObyBjb21wbGFpbnRzLg0KDQojIEhpc3Rvcnkgb2YgUHJlc2VudCBJbGxuZXNzDQpHbGVubjANCiBpcyBhIDE4IHllYXItb2xkIG5vbi1oaXNwYW5pYyB3aGl0ZSBtYWxlLg0KDQojIFNvY2lhbCBIaXN0b3J5DQogUGF0aWVudCBoYXMgbmV2ZXIgc21va2VkLg0KIFBhdGllbnQgaWRlbnRpZmllcyBhcyBoZXRlcm9zZXh1YWwuDQoNClBhdGllbnQgY29tZXMgZnJvbSBhIG1pZGRsZSBzb2Npb2Vjb25vbWljIGJhY2tncm91bmQuDQogUGF0aWVudCBkaWQgbm90IGZpbmlzaCBoaWdoIHNjaG9vbC4NClBhdGllbnQgY3VycmVudGx5IGhhcyBCbHVlIENyb3NzIEJsdWUgU2hpZWxkLg0KDQojIEFsbGVyZ2llcw0KTm8gS25vd24gQWxsZXJnaWVzLg0KDQojIE1lZGljYXRpb25zDQpObyBBY3RpdmUgTWVkaWNhdGlvbnMuDQoNCiMgQXNzZXNzbWVudCBhbmQgUGxhbg0KUGF0aWVudCBpcyBwcmVzZW50aW5nIHdpdGggaG91c2luZyB1bnNhdGlzZmFjdG9yeSAoZmluZGluZyksIG9ubHkgcmVjZWl2ZWQgcHJpbWFyeSBzY2hvb2wgZWR1Y2F0aW9uIChmaW5kaW5nKSwgZnVsbC10aW1lIGVtcGxveW1lbnQgKGZpbmRpbmcpLCBzb2NpYWwgaXNvbGF0aW9uIChmaW5kaW5nKSwgc3RyZXNzIChmaW5kaW5nKS4gDQoNCiMjIFBsYW4NCg0K",
"contentType": "text/plain; charset=utf-8"
}],
"category": [{"coding": [
{
"system": "http://loinc.org",
"code": "34117-2",
"display": "History and physical note"
},
{
"system": "http://loinc.org",
"code": "51847-2",
"display": "Evaluation + Plan note"
}
]}],
"issued": "1978-09-02T17:57:46.296-04:00",
"resourceType": "DiagnosticReport",
"status": "final"
}
Then try to find the DiagnosticReport using the information (e.g. ID) for the Patient.
It appears the Patient and DiagnosticReport are now deleted, but you can use the patient search parameter. For example, https://r4.smarthealthit.org/DiagnosticReport?patient=3190019b-9001-4e31-a3c4-380b12b8002a currently returns a Bundle of 5 DiagnosticReports.

Not getting expected search results from SmartHealthIt FHIR server for DiagnosticReport searching

I'm trying to find a patient with a DiagnosticReport using the SmartHealthIt FHIR server at https://r4.smarthealthit.org.
Queries are based on the guide at https://www.hl7.org/fhir/search.html.
If I execute the following query I get the following result that includes a patient with the id 87a339d0-8cae-418e-89c7-8651e6aab3c6.
Query:
https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
Result:
If I then query for the DiagnosticReport resources for this patient and try to filer for just the DiagnosticReport resources, I get a result that does not include any DiagnosticReport resources as shown below. Likewise, if I just retrieve the patient using https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6, I get a response that does not include the text "DiagnosticReport" or "next" (in case the resource was paged).
How do I find the set of patients that have a DiagnosticReport on a FHIR server?
Query:
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6?_elements=DiagnosticReport
Result:
{
"resourceType": "Patient",
"id": "87a339d0-8cae-418e-89c7-8651e6aab3c6",
"meta": {
"versionId": "227",
"lastUpdated": "2022-07-22T03:04:04.165-04:00",
"tag": [
{
"system": "https://smarthealthit.org/tags",
"code": "synthea-5-2019"
}
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by Synthea.Version identifier: v2.4.0-100-g26a4b936\n . Person seed: 911708758626700213 Population seed: 1559319163074</div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2106-3",
"display": "White"
}
},
{
"url": "text",
"valueString": "White"
}
]
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"system": "urn:oid:2.16.840.1.113883.6.238",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
},
{
"url": "text",
"valueString": "Not Hispanic or Latino"
}
]
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
"valueString": "Vonnie Kunde"
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
"valueCode": "F"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
"valueAddress": {
"city": "Milton",
"state": "Massachusetts",
"country": "US"
}
},
{
"url": "http://synthetichealth.github.io/synthea/disability-adjusted-life-years",
"valueDecimal": 26.256072397468692
},
{
"url": "http://synthetichealth.github.io/synthea/quality-adjusted-life-years",
"valueDecimal": 29.743927602531308
}
],
"identifier": [
{
"system": "https://github.com/synthetichealth/synthea",
"value": "293ee354-f8ad-4345-b10c-759fdfdcc082"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR",
"display": "Medical Record Number"
}
],
"text": "Medical Record Number"
},
"system": "http://hospital.smarthealthit.org",
"value": "293ee354-f8ad-4345-b10c-759fdfdcc082"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "SS",
"display": "Social Security Number"
}
],
"text": "Social Security Number"
},
"system": "http://hl7.org/fhir/sid/us-ssn",
"value": "999-97-9098"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "DL",
"display": "Driver's License"
}
],
"text": "Driver's License"
},
"system": "urn:oid:2.16.840.1.113883.4.3.25",
"value": "S99981121"
},
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport Number"
}
],
"text": "Passport Number"
},
"system": "http://standardhealthrecord.org/fhir/StructureDefinition/passportNumber",
"value": "X1974835X"
}
],
"name": [
{
"use": "official",
"family": "Kshlerin",
"given": [
"Danae"
],
"prefix": [
"Mrs."
]
},
{
"use": "maiden",
"family": "Graham",
"given": [
"Danae"
],
"prefix": [
"Mrs."
]
}
],
"telecom": [
{
"system": "phone",
"value": "555-182-4285",
"use": "home"
}
],
"gender": "female",
"birthDate": "1964-05-13",
"address": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/geolocation",
"extension": [
{
"url": "latitude",
"valueDecimal": 42.50128
},
{
"url": "longitude",
"valueDecimal": -70.897502
}
]
}
],
"line": [
"662 Ullrich Path Suite 61"
],
"city": "Salem",
"state": "Massachusetts",
"postalCode": "01907",
"country": "US"
}
],
"maritalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
"code": "M",
"display": "M"
}
],
"text": "M"
},
"multipleBirthBoolean": false,
"communication": [
{
"language": {
"coding": [
{
"system": "urn:ietf:bcp:47",
"code": "en-US",
"display": "English"
}
],
"text": "English"
}
}
]
}
---EDIT-----------------------
I'm not seeing the patient id I originally used as an example now (the data could be paged and the order not consistent so it might be on a subsequent page).
This patient ID is coming up and gives the same behavior:
87a339d0-8cae-418e-89c7-8651e6aab3c6
The following query sometimes (often) includes the patient 87a339d0-8cae-418e-89c7-8651e6aab3c6:
https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
The following query response contains neither the text "diag" nor "next"
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6?_elements=DiagnosticReport
The following query response contains neither the text "diag" nor "next"
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6
--- SECOND EDIT -------------------------
Not finding the DiagnosticReport in the Patient resource was just me being forgetful. You need to use the $everything locator as in:
https://r4.smarthealthit.org/Patient/87a339d0-8cae-418e-89c7-8651e6aab3c6/$everything
This does contain a "next" link.
I haven't yet confirmed that you eventually get to the DianosticReport resources using the next links (it seems to time out for the link below).
https://r4.smarthealthit.org/?_getpages=28d6d4cb-7f1e-4049-9cec-d3f44fba9dbf&_getpagesoffset=150&_count=50&_pretty=true&_bundletype=searchset
---THIRD EDIT --------------------------------
This patient can be used to confirm a patient with a DiagnosticReport exists:
d78af07c-9cb9-4f31-9b11-c45a28f2eec8
This url gives the first page of the patient that has a next link:
https://r4.smarthealthit.org/Patient/d78af07c-9cb9-4f31-9b11-c45a28f2eec8/$everything
This is the next link that gives the DiagnosticReport:
https://r4.smarthealthit.org/?_getpages=483b5a20-60e6-4007-8b63-3f7bbd366b18&_getpagesoffset=50&_count=50&_pretty=true&_bundletype=searchset
Here is a DiagnosticReport from the response.
"resource": {
"resourceType": "DiagnosticReport",
"id": "ca42703d-054c-4fc5-aaa5-c9d4f9688e89",
"meta": {
"versionId": "4",
"lastUpdated": "2021-04-06T03:13:59.601-04:00",
"tag": [
{
"system": "https://smarthealthit.org/tags",
"code": "synthea-5-2019"
}
]
},
"status": "final",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0074",
"code": "LAB",
"display": "Laboratory"
}
]
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "57698-3",
"display": "Lipid Panel"
}
],
"text": "Lipid Panel"
},
"subject": {
"reference": "Patient/d78af07c-9cb9-4f31-9b11-c45a28f2eec8"
},
"encounter": {
"reference": "Encounter/2e0cc97b-c879-4762-bb5c-7127e44d7daa"
},
"effectiveDateTime": "2018-09-17T15:29:24+00:00",
"issued": "2018-09-17T15:29:24.181+00:00",
"result": [
{
"reference": "Observation/b512ea5d-c4c2-49e4-9eb1-30b2579136c4",
"display": "Total Cholesterol"
},
{
"reference": "Observation/3acb284d-e861-4db2-bbbc-b1522129df3c",
"display": "Triglycerides"
},
{
"reference": "Observation/9d3359e5-58e7-4c3c-8cfd-8cb6397dbcf7",
"display": "Low Density Lipoprotein Cholesterol"
},
{
"reference": "Observation/a708a2a4-8d9a-4869-a432-c5f09a46e67f",
"display": "High Density Lipoprotein Cholesterol"
}
]
},
For a list of patients having a DiagnosticReport perhaps you could just get a list of all DiagnosticReports because this will contain the references to the patients for each of the DiagnosticReport found.
To do so you can use the query:
https://r4.smarthealthit.org/DiagnosticReport?_summary=true
In the resultset, you will see references to patients e.g.
"subject": {
"reference": "Patient/15661112-796c-460c-bf7a-6b297e33f113"
},
If you already knew the patient id e.g. 87a339d0-8cae-418e-89c7-8651e6aab3c6, you could just do:
https://r4.smarthealthit.org/DiagnosticReport?subject=87a339d0-8cae-418e-89c7-8651e6aab3c6
RE: _type parameter
Just a note on what you tried so far, the query using _type parameters is not quite right because you use type when query against the base endpoint i.e. without specifying the any type, so:
Query: https://r4.smarthealthit.org/Patient?_type=DiagnosticReport&_summary=true
Should actually have been as below, without the Patient type in the query:
Query: https://r4.smarthealthit.org?_type=DiagnosticReport&_summary=true
Read more about the _type parameter here: https://www.hl7.org/fhir/search.html#_type
RE: _elements parameter
Also, the _elements parameter is not meant for resources but for specifying base elements defined in the resource. Your query that has _elements=DiagnosticReport is not correct because the is no such element on the Patient resource, hence why you may be getting results that are not consistent.
Hope that helps?

Category is missing from outlook event from the notification

I had set up graph client notification for event updates, when I add a category to an existing event, the updated event from notification is missing the applied category sometimes. I tried to get the event at some intervals and found out that the category does show up but there is no definite time delay, does anyone know what could be the max delay or any technique to get the category immediately?
Code used to subscribe for notifications.
POST https://graph.microsoft.com/v1.0/subscriptions
Content-Type: application/json
{
"changeType": "created,updated",
"notificationUrl": "https://webhook.azurewebsites.net/notificationClient",
"resource": "/users/{userId}/mailfolders('inbox')/events",
"expirationDateTime": "2016-03-20T11:00:00.0000000Z",
"clientState": "abcd"
}
Received notification on updating an event (Added a new category to event)
{
"changeType": "updated",
"clientState": "abc",
"resource": "Users/{UserId}/Events/AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQBGAAAAAACcxCFvSYx4Qq2TvvDk7ptoBwApGtasXg2jRLv-yfVbSS5rAAAAAAENAAApGtasXg2jRLv-yfVbSS5rAAE3GB9UAAA=",
"subscriptionExpirationDateTime": "2022-02-09T00:07:27.333244-08:00",
"subscriptionId": "00508233-d60c-4905-8c4f-cb101a43f8c1",
"resourceData": {
"id": "AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQBGAAAAAACcxCFvSYx4Qq2TvvDk7ptoBwApGtasXg2jRLv-yfVbSS5rAAAAAAENAAApGtasXg2jRLv-yfVbSS5rAAE3GB9UAAA=",
"#odata.etag": "W/\"DwAAABYAAAApGtasXg2jRLv/yfVbSS5rAAE4W5d/\"",
"#odata.id": "Users/bfc9acdc-7ae7-4cbe-af4f-843acd8945d8/Events/AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQBGAAAAAACcxCFvSYx4Qq2TvvDk7ptoBwApGtasXg2jRLv-yfVbSS5rAAAAAAENAAApGtasXg2jRLv-yfVbSS5rAAE3GB9UAAA=",
"#odata.type": "#Microsoft.Graph.Event"
}
}
When I tried to get the event from graph client the category was missing in the category list
{
"allowNewTimeProposals": true,
"attendees": [],
"body": {
"content": "",
"contentType": "html",
"#odata.type": "microsoft.graph.itemBody"
},
"bodyPreview": "",
"end": {
"dateTime": "2022-01-23T03:30:00.0000000",
"timeZone": "UTC",
"#odata.type": "microsoft.graph.dateTimeTimeZone"
},
"hasAttachments": false,
"hideAttendees": false,
"iCalUId": "040000008200E00074C5B7101A82E00800000000FA8C485E1718D8010000000000000000100000002019A4F391D06D40B7A90ACC0E408951",
"importance": "normal",
"isAllDay": false,
"isCancelled": false,
"isDraft": false,
"isOnlineMeeting": false,
"isOrganizer": true,
"isReminderOn": true,
"location": {
"displayName": "ABCD",
"locationType": "default",
"uniqueId": "ABCD",
"uniqueIdType": "private",
"#odata.type": "microsoft.graph.location"
},
"locations": [
{
"displayName": "ABCD",
"locationType": "default",
"uniqueId": "ABCD",
"uniqueIdType": "private",
"#odata.type": "microsoft.graph.location"
}
],
"onlineMeetingProvider": "unknown",
"organizer": {
"emailAddress": {
"address": "{userEmail}",
"name": "{Name}",
"#odata.type": "microsoft.graph.emailAddress"
},
"#odata.type": "microsoft.graph.recipient"
},
"originalEndTimeZone": "Sri Lanka Standard Time",
"originalStartTimeZone": "Sri Lanka Standard Time",
"reminderMinutesBeforeStart": 15,
"responseRequested": true,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00+00:00",
"#odata.type": "microsoft.graph.responseStatus"
},
"sensitivity": "normal",
"showAs": "busy",
"start": {
"dateTime": "2022-01-23T03:00:00.0000000",
"timeZone": "UTC",
"#odata.type": "microsoft.graph.dateTimeTimeZone"
},
"subject": "Test1234",
"transactionId": "BFA967CF-A111-5A49-8564-C74031DEA04B_6F9F0BA5-05C8-465F-9B56-5E3318BFF06B_343",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQBGAAAAAACcxCFvSYx4Qq2TvvDk7ptoBwApGtasXg2jRLv%2FyfVbSS5rAAAAAAENAAApGtasXg2jRLv%2FyfVbSS5rAAE0tLDTAAA%3D&exvsurl=1&path=/calendar/item",
"categories": [],
"changeKey": "KRrWrF4No0S7/8n1W0kuawABNJg+hw==",
"createdDateTime": "2022-02-02T09:29:25.2557072+00:00",
"lastModifiedDateTime": "2022-02-02T09:37:47.6734052+00:00",
"id": "AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQBGAAAAAACcxCFvSYx4Qq2TvvDk7ptoBwApGtasXg2jRLv-yfVbSS5rAAAAAAENAAApGtasXg2jRLv-yfVbSS5rAAE0tLDTAAA=",
"#odata.type": "microsoft.graph.event",
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{userId}')/events/$entity",
"#odata.etag": "W/\"KRrWrF4No0S7/8n1W0kuawABNJg+hw==\"",
"occurrenceId": null,
"calendar#odata.associationLink": "https://graph.microsoft.com/v1.0/users('{userId}')/calendars('AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQAuAAAAAACcxCFvSYx4Qq2TvvDk7ptoAQApGtasXg2jRLv-yfVbSS5rAAAAAAENAAA=')/$ref",
"calendar#odata.navigationLink": "https://graph.microsoft.com/v1.0/users('userId')/calendars('AAMkAGJjMGZiYmVmLTdkNzctNDFjMy05MDdmLTQ5MzM1NWZjZWVhZQAuAAAAAACcxCFvSYx4Qq2TvvDk7ptoAQApGtasXg2jRLv-yfVbSS5rAAAAAAENAAA=')",
"responseHeaders": {
"cache-Control": ["private"],
"transfer-Encoding": ["chunked"],
"vary": ["Accept-Encoding"],
"strict-Transport-Security": ["max-age=31536000"],
"request-id": ["110a7a40-540d-46d2-9687-a50ea7994ab9"],
"client-request-id": ["110a7a40-540d-46d2-9687-a50ea7994ab9"],
"x-ms-ags-diagnostic": [
"{\"ServerInfo\":{\"DataCenter\":\"South India\",\"Slice\":\"E\",\"Ring\":\"2\",\"ScaleUnit\":\"000\",\"RoleInstance\":\"MA1PEPF00002512\"}}"
],
"date": ["Wed, 02 Feb 2022 09:37:50 GMT"]
},
"statusCode": "OK"
}

rethinkdb, How could I pluck the result by a value in particular "array index"?

sample data
[
{
"createdDate": 1508588333821,
"data": {
"image_extension": "png",
"name": "Golden",
"qty": 1,
"remark": "#296-2",
"status": "RETURN",
"owner": [
{
"name": "app1emaker",
"location": 1
},
{
"name": "simss92_lmao",
"location": 31
}
]
},
"deleted": false,
"docId": 307,
"docType": "product",
"id": "db0131f9-9359-4aa3-b6ed-cd9f3ff4aa3e",
"updatedDate": 1553155281691
},
{
"createdDate": 1508588333324,
"data": {
"image_extension": "png",
"name": "Golden",
"qty": 1,
"remark": "#296-2",
"status": "DISCARD",
"owner": [
{
"name": "At533",
"location": 7
},
{
"name": "madsimon",
"location": 64
},
{
"name": "boyboy96",
"location": 1
},
{
"name": "xinfengCN",
"location": 5
}
]
},
"deleted": false,
"docId": 308,
"docType": "product",
"id": "3790bdaa-5347-4ab0-8149-37332c23c6ea",
"updatedDate": 1554555231691
},
...
...
]
And said that, I would like to select the data.owner on array index 0 only (or I should say data.owner[0]), which are
{
"name": "app1emaker",
"location": 1
}
and
{
"name": "At533",
"location": 7
}
in this case. I have a failed code below.
r.db('carbon').table("items").pluck(['id', 'docId', 'createdDate',{data:{name: true, owner:[0]}}])
I saw that for some functions like orderBy, rethinkdb allowed to use orderBy(r.row('data')('owner')(0)('name')) for access nested object, but I have no idea how to do this for pluck? could anyone give me some hints?
Thanks a lot
pluck can not do that, but you can fall back to use the map:
r.db("carbon").table("items").map(function(doc){
return {
"id": doc("id"),
"docId": doc("docId"),
"createdDate": doc("createdDate"),
"data": {
"name": doc("data")("name"),
"owner": doc("data")("owner")(0)
}
}
})

FHIR and DocumentReference

How can I get DocumentReference for particular document from DocumentManifest list of documents?
Here is an example of returned DocumentManifest
{
"title": {
},
"id": {
},
"updated": {
},
"content": {
"type": {
"#id": "urn:uuid:xxxxxx-xxxx-xxxx-xxxx-xxxxxxx",
"text": "Patient Document List"
},
"resourceType": "DocumentManifest",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Some Test ORG</div>"
},
"contained": {
"resourceType": "Patient",
"identifier": {
"use": "official",
"system": "",
"value": "12345678987654321"
}
},
"subject": {
"reference": "Patient Documents"
},
"recipient": {
"organization": {
"display": "Some Test ORG"
}
},
"created": "2018-02-09T13:26:53-07:00",
"status": "current",
"content": {
"reference": [
"Binary/DOCUMENT-1000123",
"Binary/DOCUMENT-1000124",
"Binary/DOCUMENT-1000125"
]
}
}
}
I have tried to use something like
GET [service-url]/DocumentReference/?_query=generate&uri=[service-url]/BINARY/DOCUMENT-1000125
but I had no luck.
That DocumentManifest is not pointing at a DocumentReference. It is point at a document.
FYI: What you have shown is not compliant with IHE-MHD use of DocumentReference/DocumentManifest/Binary.

Resources