Run mappings

Note

A whole tutorial referenced here is available in the following Postman collection: https://documenter.getpostman.com/view/1515623/2sAXqqbhKp

State of the engine has now been prepared, meaning you can start testing your mappings.

openEHR to FHIR

To map from openEHR Composition to FHIR Resource(s), you need to have a composition either in a flat format or in a canonical json format. Example based on the template we’re working on is available in the two links below.

POST http://localhost:8080/openfhir/tofhir?templateId=Growth chart
POST http://localhost:8080/openfhir/tofhir?templateId=Growth%2Cchart HTTP/1.1
Content-Type: application/json
Body: <json below>

growth_chart_flat.json

Alternatively, you can try with a Composition in canonical json format, in which case you do not need to provide a templateId in the request.

POST http://localhost:8080/openfhir/tofhir
POST http://localhost:8080/openfhir/tofhir HTTP/1.1
Content-Type: application/json
Body: <json below>

growth_chart_canonical.json

FHIR to openEHR

Beautify of the engine is that it is able to run bidirectional mappings, meaning the state we have prepared in a previous step is used for mapping from FHIR to openEHR and vice versa. To test mapping in the other direction, you can simply copy-paste output of the step above or use one provided in the link below. Then invoke a /toopenehr endpoint to get the mapped result.

POST http://localhost:8080/openfhir/toopenehr
POST http://localhost:8080/openfhir/toopenehr HTTP/1.1
Content-Type: application/json
Body: <json below>

growth_chart_fhir.json

Note

Feel free to play around with bodies of requests above and see how the mapping engine behaves. In the next step, we’ll be adding a new data point to our existing mapping file.