Skip to content
dotasek edited this page Dec 20, 2022 · 6 revisions

The example code in this repository demonstrates how to validate FHIR resources using the org.hl7.fhir.core libraries.

Project Setup

To use these libraries in your project you will first have to define them as dependencies. Some definitions for common build systems have been included below.

Maven

<dependency>
  <groupId>ca.uhn.hapi.fhir</groupId>
  <artifactId>org.hl7.fhir.validation</artifactId>
  <version>5.6.88</version>
</dependency>

 <!-- Needed to define external servers -->
 <dependency>
   <groupId>com.squareup.okhttp3</groupId>
   <artifactId>okhttp</artifactId>
   <version>4.9.0</version>
 </dependency>

Gradle

implementation group: 'ca.uhn.hapi.fhir', name: 'org.hl7.fhir.validation', version: '5.6.88'

// Needed to define external servers
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.0'

Gradle (kotlin)

implementation("ca.uhn.hapi.fhir:org.hl7.fhir.validation:5.6.88")

// Needed to define external servers
implementation("com.squareup.okhttp3:okhttp:4.9.0")

Once your project has these dependencies, you can customize the code in these examples to perform the validation your require.

Validation

The validation process is broken down into three steps:

  1. Initializing the Validation Engine
  2. Loading IGs
  3. Validating Resources

Each step links to code examples that are also used to run JUnit tests to verify their functionality.

Clone this wiki locally