Add extension to R4 Patient - hl7-fhir

How do I add the below to an R4 Patient?
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 1.0
}
The objects that were under stu2 and stu3 (I think) have been deprecated.
DSTU3 and Later
// Create an example patient
Patient patient = new Patient();
patient.addIdentifier().setUse(Identifier.IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");
// Create an extension
Extension ext = new Extension();
ext.setUrl("http://example.com/extensions#someext");
ext.setValue(new DateTimeType("2011-01-02T11:13:15"));
// Add the extension to the resource
patient.addExtension(ext);
Full "response" json from patient match below (sample data, not real data !! )
{
"resourceType": "Bundle",
"id": "94897c77-4120-482f-bdb4-4c8b9a71ade1",
"meta": {
"versionId": "1",
"lastUpdated": "2020-11-24T08:45:49.445-05:00"
},
"type": "searchset",
"total": 1,
"link": [
{
"relation": "self",
"url": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/$match?"
}
],
"entry": [
{
"fullUrl": "http://wildfhir4.aegis.net/fhir4-0-0/Patient/9126db824dcf4d5ab3f68e63bd5eaced",
"resource": {
"resourceType": "Patient",
"id": "9126db824dcf4d5ab3f68e63bd5eaced",
"meta": {
"versionId": "1",
"lastUpdated": "2020-09-03T09:03:28.193-04:00",
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActReason",
"code": "HTEST",
"display": "test health data"
}
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><tbody><tr><td>Name</td><td>Peter James \n <b>Chalmers</b> ("Jim") \n </td></tr><tr><td>Address</td><td>534 Erewhon, Pleasantville, Vic, 3999</td></tr><tr><td>Contacts</td><td>Home: unknown. Work: (03) 5555 6473</td></tr><tr><td>Id</td><td>MRN: 12345 (Acme Healthcare)</td></tr></tbody></table></div>"
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
"valueString": "VV"
}
]
},
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
}
},
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 1.0
}
}
]
}
APPEND: I found this:
https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/org/hl7/fhir/r4/model/codesystems/MatchGrade.html

That extension isn't allowed on Patient. It's defined with a context of Bundle.entry.search. It's not a characteristic of the patient themselves, it's a characteristic of a particular entry in a search result based on a specific set of search criteria. The same Patient instance might well be a good result on one search and a poor result on a different search. So to add the extension, you'd have to add it on a 'search' object, not patient.

Ok.
Here it is. The primary objects were inner/nested objects under Bundle....thus why I didn't see them early. (example : Bundle.BundleEntrySearchComponent)
// a java example with the import statements. #shocking!
//import org.hl7.fhir.r4.model.Bundle;
//import org.hl7.fhir.r4.model.CodeType;
//import org.hl7.fhir.r4.model.Extension;
//import org.hl7.fhir.r4.model.Patient;
//import org.hl7.fhir.r4.model.codesystems.MatchGrade;
//import java.util.Collections;
Bundle innerBundle = new Bundle();
innerBundle.setType(Bundle.BundleType.SEARCHSET);
innerBundle.setTotal(1);
Patient pat = new Patient();
HumanName hn = new HumanName();
hn.setFamily("Smith");
p.setName(Collections.singletonList(hn));
Bundle.BundleEntrySearchComponent besc = new Bundle.BundleEntrySearchComponent();
besc.setScore(0.88);
besc.setMode(Bundle.SearchEntryMode.MATCH);
Bundle.BundleEntryComponent bec = new Bundle.BundleEntryComponent();
Extension matchGradeExtension = besc.addExtension();
matchGradeExtension.setUrl("http://hl7.org/fhir/StructureDefinition/match-grade");
matchGradeExtension.setValue(new CodeType(MatchGrade.PROBABLE.toCode()));
bec.setResource(pat);
bec.setSearch(besc);
innerBundle.setEntry(Collections.singletonList(bec));
Json looks like this:
{
"resourceType": "Bundle",
"type": "searchset",
"total": 1,
"entry": [
{
"resource": {
"resourceType": "Patient",
"name": [
{
"family": "Smith"
}
]
},
"search": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/match-grade",
"valueCode": "certain"
}
],
"mode": "match",
"score": 0.88
}
}
]
}

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.

How can I read array data in table format using Talend ETL?

Hello,
I'm new in Talend. Want to extract data from file to table format.
What will steps to retrieve data in column format from below data -( _id,projectName,title,value)
Array data -
[
{
"_id": 1,
"projectName": "Test",
"languageId": 1,
"userId": 100,
"userDetails": {
"location": {
"coordinates": [
19.2666415,
72.9814762
]
},
"serialNumber": "5ab24f2d2ce1"
},
"questionDetails": [
{
"_id": 1,
"title": "QuestionName 01",
"description": "QuestionName 01",
"question": "QuestionName 01",
"type": "Radio",
"optionMap": {
"1": "Option 01",
"2": "Option 01"
},
"response": {
"value": [
"2"
]
},
"responseExtension": {
"comments": "",
"reviews": "",
"summary": "",
"imageURLs": [
],
"videoURLs": [
],
"audioURLs": [
]
}
}
],
"createdDate": {
"$date": {
"$numberLong": "1603802807000"
}
},
"lastModifiedDate": {
"$date": {
"$numberLong": "1603802807000"
}
},
"_class": "dummy"
},
{
"_id": 2,
"projectName": "Test",
"languageId": 1,
"userId": 101,
"surveyId": 1,
"sectionId": 10,
"userDetails": {
"location": {
"coordinates": [
19.0564471,
72.9033019
]
},
"serialNumber": "d8ee581588c2"
},
"questionDetails": [
{
"_id": 11,
"title": "QuestionName 02",
"description": "QuestionName 02",
"question": "QuestionName 02",
"type": "Radio",
"optionMap": {
"1": "Option 02",
"2": "Option 02"
},
"response": {
"value": [
"1"
]
},
"responseExtension": {
"comments": "",
"reviews": "",
"summary": "",
"imageURLs": [
],
"videoURLs": [
],
"audioURLs": [
]
}
}
],
"isActive": false,
"communication": {
},
"questionIndex": 0,
"isAboutToFinish": false,
"managingStatus": "archived",
"sectionIds": [
],
"questionResponses": [
],
"createdDate": {
"$date": {
"$numberLong": "1603372059000"
}
},
"lastModifiedDate": {
"$date": {
"$numberLong": "1658313691000"
}
},
"_class": "dummy"
}
]

Elastic search query - all objects of nested array should have specific value

I want to write Elasticsearch query where I am able to look into a nested array, and check a key for all those elements inside the array, if all of them have that value then the root document should be selected.
this is a sample data :
[
{
"_index": "allproperties",
"_type": "_doc",
"_id": "5241050",
"_score": 0.0,
"_source": {
"id": 5241050,
"type": "HOUSE",
"state": "NSW",
"agency": {
"id": 31,
"code": "AU_LNT",
"name": "Luthor Properties",
"config": "{}"
},
"branch": {
"id": 89,
"name": "Luthor Sales Unit Trust",
"tradingName": "Luthor Properties",
"internalCode": "AU_LNT_G"
},
"images": null,
"leases": [
{
"id": 26439,
"bond": 2000,
"leased": true,
"source": "PORTAL",
"status": "SIGNED",
"endDate": "2022-11-06T00:00:00",
"tenants": [
{
"id": 11106,
"role": "TENANT",
"user": {
"id": 38817,
"dob": "1900-01-01",
"name": "Liam",
"email": "tempo#tempo.com",
"phone": "+61400000000",
"surname": "Tempo",
"salutation": "Mr.",
"invitations": null,
"lastInAppActivity": null
},
"address": "45675 Bruce Hwy, Coolbie QLD 4850, Australia",
"extendedData": "{\"rentSplitAmount\":22.62}",
"roleAdjective": "PRIMARY",
"addressComponents": {
"state": "QLD",
"suburb": "Coolbie",
"country": "Australia",
"postcode": "4850",
"streetName": "Bruce Hwy",
"unitNumber": null,
"poboxNumber": null,
"streetNumber": "45675",
"addressComponentsUnavailable": null
}
}
],
"signDate": "2022-10-05T04:58:08.887",
"startDate": "2022-10-06T00:00:00",
"moveInDate": "2022-10-06T00:00:00",
"appointments": [
{
"id": 3506,
"type": "REMOTE",
"date_time": "2022-10-12T04:56:00+00:00",
"createdBy": "Lex Luthor",
"createdDate": "2022-10-05T04:56:52.936",
"lastModifiedBy": "Lex Luthor",
"lastModifiedDate": "2022-10-05T04:56:53.51"
}
],
"createdDate": "2022-10-05T04:55:42.247",
"rentalAmount": 500,
"dateAvailable": null,
"extendedData": {
"last_rent_adjustment_date": 1665014400000
},
"leaseDuration": 32,
"rentalFrequency": "2",
"signedManually": false
}
],
"refId": "b66326eb-a6b2-42b6-b058-b46847e13399",
"source": "PT",
"status": null,
"suburb": "Hurstville",
"address": "456 Forest Road Hurstville NSW AUSTRALIA 2220",
"country": "Australia",
"bedrooms": 3,
"category": null,
"pmsCode": "84c34d15-a0ab-4791-b9e3-1bdac215b99c",
"postcode": "2220",
"agencyId": 31,
"bathrooms": 3,
"branchId": 89,
"carspaces": 3,
"createdBy": "system",
"streetname": "Forest Road",
"unitnumber": null,
"description": null,
"createdDate": "2022-10-05T04:51:12.619",
"entitlements": [
{
"id": 3453799,
"role": "LANDLORD",
"user": {
"id": 22855,
"dob": null,
"name": "please enter ownership name",
"email": "mag.m#rr.com.au",
"phone": "0400000000",
"surname": "",
"salutation": null,
"lastInAppActivity": null
},
"company": {
"id": 137,
"abn": "",
"acn": "",
"phone": "0400000000",
"address": "1234 Park Avenue New York NY USA 10037-1702",
"companyName": "please enter ownership name",
"displayName": "please enter ownership name",
"email": "mag.m#rr.com.au"
},
"roleAdjective": "GROUP"
},
{
"id": 3453800,
"role": "AGENT",
"user": {
"id": 20054,
"dob": null,
"name": "Paul",
"email": "p.b#mr.com",
"phone": "+61403084232",
"surname": "Botti",
"salutation": null,
"lastInAppActivity": null
},
"company": null,
"roleAdjective": "MANAGING"
},
{
"id": 3453801,
"role": "AGENT",
"user": {
"id": 20054,
"dob": null,
"name": "Paul",
"email": "p.b#mr.com",
"phone": "+61403084232",
"surname": "Botti",
"salutation": null,
"lastInAppActivity": null
},
"company": null,
"roleAdjective": "LEASING"
}
],
"streetnumber": "456",
"advertised": false,
"commission_type": null,
"lastModifiedBy": "system",
"lastModifiedDate": "2022-10-05T04:58:09.043",
"_meta": {
"branches": {
"id": [
89
]
},
"agencies": {
"id": [
31
]
},
"user_property_entitlement": {
"id": [
3453799,
3453800,
3453801
]
},
"users": {
"id": [
20054,
22855,
38817
]
},
"companies": {
"id": [
137
]
},
"leases": {
"id": [
26439
]
},
"user_lease_entitlement": {
"id": [
11106
]
},
"appointments": {
"id": [
3506
]
}
}
},
"sort": [
1664945472619,
0.0
]
}
]
In this particular case, leases is a nested document, I want to select the documents where all the leases are in cancelled state or leases is null, i.e; either all of the objects inside leases should have status as CANCELLED or the leases key should be null.
Already went through this question, but did'nt quite get it as its an old answer from 2015 and methods used in this got deprecated.
Try this query:
GET idx_test/_search?filter_path=hits.hits
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "leases",
"query": {
"bool": {
"must_not": [
{
"bool": {
"should": [
{
"term": {
"leases.status.keyword": "CANCELLED"
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "leases"
}
}
]
}
}
]
}
}
]
}
}
}
}
]
}
}
}

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?

When connecting to LUIS, what does the "forceset" parameter do

In my LUIS app I have an intent called GetWeather requiring a Location to be set.
When connecting to the app using the query
What is the weather in london
it correctly returns
{
"query": "what is the weather in london",
"topScoringIntent": {
"intent": "GetWeather",
"score": 0.999875546,
"actions": [
{
"triggered": true,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": [
{
"entity": "london",
"type": "Location",
"resolution": {}
}
]
}
]
}
]
},
"entities": [
{
"entity": "london",
"type": "Location",
"startIndex": 23,
"endIndex": 28,
"score": 0.832388461,
"resolution": {}
}
],
"dialog": {
"contextId": "e1df6c2d-e691-4fc6-89f2-3ee2ef519724",
"status": "Finished"
}
}
If I instead use the query
What is the weather
It returns the following expected result.
{
"query": "what is the weather",
"topScoringIntent": {
"intent": "GetWeather",
"score": 1.0,
"actions": [
{
"triggered": false,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": null
}
]
}
]
},
"entities": [],
"dialog": {
"prompt": "Where",
"parameterName": "Location",
"parameterType": "Location",
"contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
"status": "Question"
}
}
I thought that using the contextID together with the forceSet parameter in my next call would set the parameter Location to whatever I send as the query. The conection string I use is this:
https://api.projectoxford.ai/luis/v2.0/apps/{APP_ID}?subscription-key={SUBSCRIPTION_KEY}&q=london&contextid=3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1&forceset=Location
Instead I get the following response back:
{
"query": "london",
"topScoringIntent": {
"intent": "GetWeather",
"score": 1.0,
"actions": [
{
"triggered": false,
"name": "GetWeather",
"parameters": [
{
"name": "Location",
"type": "Location",
"required": true,
"value": null
}
]
}
]
},
"entities": [],
"dialog": {
"prompt": "Where",
"parameterName": "Location",
"parameterType": "Location",
"contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
"status": "Question"
}
}
I had expected to get something like my first response back.
Am I doing something wrong or just misunderstanding what the forceSet parameter is supposed to do?

Resources