@judywawira suggest to create a module from scratch that use JSON output of REST module to convert it to the FHIR compatible JSON.
Patient -> Patient REST API JSON Output-> NewModuleConverter JSON to FHIR JSON -> FHIR Patient output
I had look at the rest module of openmrs. There isn’t any service that can obtain the JSON representation. REST module seems it’s defines a representation and then it convert the returning object to JSON representation internally. So we can’t add the module as dependency and access the JSON representation.
Other approach is calling the rest endpoint to get the JSON and then convert it to FHIR compatible resource. But this requires credentials of a user. Would this be a good approach?
Nice. I have one question. The JSON that is been spit out by the REST module depends on the properties of it’s model. For example, the JSON that will be spit out when you request for a patient will depend on the properties of the Patient class. So let’s say a required FHIR field is missing in the JSON spitted out by the REST module, how will this converter handle this?
I think we need to check the FHIR specification of that resource. When I look at it, I notice some properties are mandatory and some aren’t. So we will need to take the decision based on it. May be we can include a default value. what do you think?
I think the best way to approach this, is to think of this as an app that is doing integration testing. So you do not need to write this app, like an OpenMRS module. Instead, think of it as writing a standalone app, which has JUnit tests for each resource transformation.
Of course, you will need user credentials to make the REST calls. But that is just an BasicAuth header when making the REST calls.
@prashadi, I’ve tried to be very conservative with my words here. But please feel free to expand this into a step-by-step process, and ask questions if you think my suggested approach is a quick way to get this done.
You’re on FHIR @prashadi !
Honestly, we need a LOT of familiarization with FHIR here at LH.io to meet our needs. At the same time, I can’t imagine that knowledge of the FHIR schema/api wouldn’t be a very important piece of a medical IT resume.
We need to set everything on FHIR, and collectively, our matches are a bit damp.
Can anyone help me out because I am also trying to build a small demo to convert Patient JSON based on @sunbiz directives but I get the same “peer not authenticated” error
I completed fhir to librehealth json representation as well.
Following are the outputs
CONVERTED LIBRE HEALTH PATIENT TO FHIR
{“resourceType”:“Patient”,“id”:“f19c6540-0058-4bb2-9019-d61dd6afd0ce”,“identifier”:[{“id”:“f625a561-6cef-4e5a-a661-72377641d8d4”,“use”:“usual”,“system”:“Old Identification Number”,“value”:“1234”}],“active”:false,“name”:[{“id”:“9a4df03d-731e-4023-ae88-af7d82f86777”,“family”:“family1”,“given”:[“test1”]}],“gender”:“female”,“birthDate”:“1984-01-01”,“address”:[{“id”:“1bb9664c-da14-4db6-aea6-018046c8841c”,“use”:“home”,“line”:[“Address1”,“Address12”],“city”:“SampleVillege”,“state”:“SampleProvince”,“postalCode”:“7878”,“country”:“SampleCountry”}]}
Both of those are sort of depending on a model. I like the spec from @lehone, but I think it is still very much hard-coded and will not work as the spec changes. On the other hand, most FHIR servers provide a /validate endpoint. You should use those, and your code should iteratively remember/learn from that validation process.
@lehone, I think you only got the one-way working, because I didnt see FHIR to REST conversion.
I have used HAPI FHIR library to perform the Librehealth JSON to FHIR conversion. I think this will be good as it provides all the FHIR version support and validations. Hence populating the relevant resource in FHIR specification gives me a advantage of simply convert the model to JSON from a standard library and use particular object for validation. With the library we can convert the required librehealth resources to required FHIR version. I will look at publicly exposed FHIR validation endpoints as well.
Regarding the FHIR to REST, I convert FHIR JSON to its model representation and then used it to build the librehealth format of the resource.
One challenge I encounter was there were no mappings for some attributes.
@sunbiz what should I do next? I will add validations to the resources. I think we need to validate the librehalth format of resource as well.
Sorry about the FHIR to REST conversion, I have been a little bit busy but I will complete it shortly.
It is indeed dependent on a model but we will face a problem if the spec change. We will need to look for a way in order to fix that but I posted the converted resource to an FHIR server for validation.
I have given this task to modify the module by @judywawira So I want to know about the objective of this task and what technology i can use to complete this work