FHIR Chat · Issue while fetching data from mongodb · implementers

Stream: implementers

Topic: Issue while fetching data from mongodb


view this post on Zulip Kumari Anamika (Nov 26 2020 at 18:04):

Hello,
I am using HAPI FHIR Patient model and imported patient.ndjson file into mongodb and example of data is like this:
{ "resourceType":"Patient","id":"xyz","text":{"status":"generated","div":"<div xmlns=\"http://www.w3.org/1999/xhtml\">Generated by <a href=\"https://github.com/synthetichealth/synthea\">Synthea</a>.Version identifier: v2.4.0-89-g19f2b36a\n . Person seed: 899179670374048718 Population seed: 1555536562268</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":"2135-2","display":"Other"}},{"url":"text","valueString":"Other"}]},{"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":"Hee424 Buckridge80"},{"url":"http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex","valueCode":"M"},{"url":"http://hl7.org/fhir/StructureDefinition/patient-birthPlace","valueAddress":{"city":"North Andover","state":"Massachusetts","country":"US"}},{"url":"http://synthetichealth.github.io/synthea/disability-adjusted-life-years","valueDecimal":0.0},{"url":"http://synthetichealth.github.io/synthea/quality-adjusted-life-years","valueDecimal":14.0}],"identifier":[{"system":"https://github.com/synthetichealth/synthea","value":"e8499264-e508-4d4d-b7d8-d1af20e3d938"},{"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":"e8499264-e508-4d4d-b7d8-d1af20e3d938"},{"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-90-9234"}],"name":[{"use":"official","family":"Muller251","given":["Julio255"]}],"telecom":[{"system":"phone","value":"555-405-7445","use":"home"}],"gender":"male","birthDate":"2004-05-23","address":[{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/geolocation","extension":[{"url":"latitude","valueDecimal":42.284822},{"url":"longitude","valueDecimal":-71.348811}]}],"line":["693 Roberts Station Suite 73"],"city":"Natick","state":"Massachusetts","postalCode":"01760","country":"US"}],"maritalStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-MaritalStatus","code":"S","display":"Never Married"}],"text":"Never Married"},"multipleBirthBoolean":false,"communication":[{"language":{"coding":[{"system":"urn:ietf:bcp:47","code":"en-US","display":"English"}],"text":"English"}}]}

I am unable to perform the search by Id or any search operation through mongo query writen in repository java file .
@Query(value = "{'name.family':?0}")
List<Patient> findByPatientName(String family);
@Query(value = "{'id':?0}")
Patient findByPatientId(String id);

Getting the below error:
ERROR-FIND-BY-ID.PNG ERROR-FIND-BY-NAME.PNG

view this post on Zulip Yunwei Wang (Nov 27 2020 at 14:46):

Not an expert on Mongo, nor HAPI. I think this error is pretty clear that you need convert from BSON to JSON first: image.png


Last updated: Apr 12 2022 at 19:14 UTC