carreraGroup / avro-on-fhir

Apache License 2.0
0 stars 0 forks source link

avro-on-fhir

AVRO models for the 4.0.1 version of FHIR.
The AVRO schema is generated from the FHIR JSON schema.

Developing

Unless we start adding logical types, there's not a lot of development to be done here.
This project really just glues together a few different code generators.

Prerequisites

Build

export J2A_INSTALL_DIR=/path/to/json-to-avro-schema/directory
make

The makefile downloads the schema from HL7 and applies a small patch because the generator requires the root json schema to have an $id.

Our json-to-avro-schema tool is used to generate the AVRO schema. You must set the $J2A_INSTALL_DIR environment variable before running the makefile.

The generated schema is output to src/main/avro/fhir.avsc for the gradle avro plugin to pick up.

At this time, the gradle build step will fail to generate the Java files. Once json-to-avro-schema is generating correct AVRO schemas, this will complete successfully and generate a jar.

Make Targets

Windows

Windows uses a different gradle wrapper script. To build on a Windows device, either use WSL or set the GRADLE variable when running make.

GRADLE=./gradlew.bat make

Roadmap

The majority of the development that needs to occur is in the json-to-avro-schema tool.
Once it is capable of correctly transpiling the JSON schema to AVRO schema, we just need to add a CI action to build and publish the resulting jar and fhir.avsc file.