6.4. Do the mapping

If not further mentioned, the paths are relative to fhir-bridge/src/main/java/org/ehrbase/fhirbridge ## Prepare setup

6.4.1. Create new branch

Each change to the FHIR bridge should have a ticket created, explaining the change. Create a new feature branch with ticket number like: feature/123_awesome_new_feature, where 123 stands for the issue number

# optional: make a new checkout
git clone git@github.com:ehrbase/fhir-bridge.git
# default:
cd fhir-bridge
git checkout -b [BRANCH-NAME]
# At the first push:
git push -u origin [BRANCH-NAME]
# For later pushes:
git push

6.4.2. Start docker

Start docker, the erhdb and the fhirdb if they don’t already run. For example (Birgit 2020-10-16)

docker rm ehrdb
docker rm ehrbase
docker run --name ehrdb --network ehrbase-net -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 ehrbase/ehrbase-postgres:latest
docker run --name ehrbase --network ehrbase-net -d -p 8080:8080 -e DB_URL=jdbc:postgresql://ehrdb:5432/ehrbase -e DB_USER=ehrbase -e DB_PASS=ehrbase -e AUTH_TYPE=none -e SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true -e SERVER_NODENAME=local.ehrbase.org ehrbase/ehrbase:latest
docker run -p 9999:5432 --name fhir-bridge -e POSTGRES_PASSWORD=fhir_bridge -e POSTGRES_USER=fhir_bridge -d postgres

6.4.3. Build

Build the current fhir-bridge

mvn clean install

6.4.4. IDE

Load project into development environment

  • especially for eclipse: as a Maven project

6.4.4.1. Add external files

The following files must be copied into the respective target directories.

6.4.4.2. Design the mapping

6.4.5. Structure Definition (Enum)

  • copy the Fhir-Url from resources/profiles/[TEMPLATE].opt to fhir/Profile.java
<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition/body-height" />
  <name value="BodyHeight" />
  • if your FHIR-observation-sample-file contains an extension, add its Profile URL, too.
  • Add an entry in /config/util/OperationalTemplateData.java with the name of the opt-file and the template_id-value
# Koerpergroesse.opt
[...]
    <template_id>
        <value>Körpergröße</value>
    </template_id>
HEART_RATE("", "Koerpergroesse.opt", "Körpergröße"),

6.4.6. Use the SDK generator to create new classes from the operational template

  • (Windows example started from the path :code:`../openEHR_SDK/generator/target)
java
-jar generator-0.3.7.jar
-opt ../../../fhir-bridge/src/main/resources/opt/Atemfrequenz.opt
-out ../../../fhir-bridge/src/main/java
-package org.ehrbase.fhirbridge.opt
  • Linux example (only resource-opt needs to be adapted)
java -jar ../openEHR_SDK/generator/target/generator-0.3.7.jar -opt src/main/resources/opt/KlinischeFrailty.opt -out src/main/java/ -package org.ehrbase.fhirbridge.opt
  • Note: Ignore error message regarding missing language packages (temporary problem; TerminologyProvider).
  • Refresh project in the development environment
  • New classes and structures (example breathing rate)
$ opt/breathingfrequencycomposition
├── BreathrateComposition.java
├── BreathrateCompositionContainment.java
├── definition
    ├── RespiratoryRateObservation.java
    └── RespiratoryRateObservationContainment.java

            Structure Definition (Enum)

  • copy the Fhir-Url from resources/profiles/[TEMPLATE].opt to fhir/Profile.java
<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition/body-height" />
  <name value="BodyHeight" />
  • if your FHIR-observation-sample-file contains an extension, add its Profile URL, too.
  • Add an entry in /config/util/OperationalTemplateData.java with the name of the opt-file and the template_id-value
# Koerpergroesse.opt
[...]
    <template_id>
        <value>Körpergröße</value>
    </template_id>
HEART_RATE("", "Koerpergroesse.opt", "Körpergröße"),

6.4.7. Use the SDK generator to create new classes from the operational template

  • (Windows example started from the path :code:`../openEHR_SDK/generator/target)
java
-jar generator-0.3.7.jar
-opt ../../../fhir-bridge/src/main/resources/opt/Atemfrequenz.opt
-out ../../../fhir-bridge/src/main/java
-package org.ehrbase.fhirbridge.opt
  • Linux example (only resource-opt needs to be adapted)
java -jar ../openEHR_SDK/generator/target/generator-0.3.7.jar -opt src/main/resources/opt/KlinischeFrailty.opt -out src/main/java/ -package org.ehrbase.fhirbridge.opt
  • Note: Ignore error message regarding missing language packages (temporary problem; TerminologyProvider).
  • Refresh project in the development environment
  • New classes and structures (example breathing rate)
$ opt/breathingfrequencycomposition
├── BreathrateComposition.java
├── BreathrateCompositionContainment.java
├── definition
    ├── RespiratoryRateObservation.java
    └── RespiratoryRateObservationContainment.java