Preload Configuration

Ontoserver includes a mechanism to preload content (including ValueSet, CodeSystem, ConceptMap and StructureDefinition resources) on startup.

There are different ways to use this feature. Some of these are demonstrated below.

1. Preload a bundle of resources

The Ontoserver docker image includes a preload feed that points to a FHIR Bundle at file:///data/preload.json.

This can be overwritten with a new Bundle to make Ontoserver load other resources.

For example, the following Bundle includes a very simple CodeSystem resource:

  {
    "resourceType": "Bundle",
    "type": "batch",
    "entry": [
      {
        "resource": {
          "resourceType": "CodeSystem",
          "url": "http://sample.com/CodeSystem/1",
          "status": "draft",
          "content": "complete",
          "concept": [
            {
              "code": "A",
              "display": "First concept"
            },
            {
              "code": "B",
              "display": "Second concept"
            }
          ]
        }
      }
    ]
  }

Having created this in a file called preload.json, we can make a new docker image using a Dockerfile like:

  FROM quay.io/aehrc/ontoserver:ctsa-6.1
  COPY preload.json data/preload.json

We can then put the Dockerfile and our preload.json file in a directory (e.g. myOntoserver), and tweak our docker-compose.yml file to use our new image instead of the base Ontoserver image, by replacing the line

    image: quay.io/aehrc/ontoserver:ctsa-6.1

with

    build: myOntoserver

and running it with a build step, such as

docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d

2. Preload with a feed of resources

If you prefer to load resources separately rather than bundling them up, another option is to create a syndication feed and preload content from that.

For example, the following feed includes a CodeSystem and a ValueSet.

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:ncts="http://ns.electronichealth.net.au/ncts/syndication/asf/extensions/0.1.0">
    <title type="text">My preload feed</title>
    <link rel="alternate" type="application/atom+xml" href="file:///data/preload.xml"/>
    <updated>2019-06-30</updated>
    <id>urn:uuid:b617906a-e0f8-45f7-a0f3-0742a2bb3135</id>
    <ncts:atomSyndicationFormatProfile version="http://ns.electronichealth.net.au/ncts/syndication/asf/profile/0.1.0"/>

  <entry>
      <title>My CodeSystem</title>
      <category term="FHIR_CodeSystem" label="FHIR Code System" scheme="http://ns.electronichealth.net.au/ncts/syndication/asf/scheme/1.0.0" />
      <id>7f6af166-cf09-4741-83d3-ac2be4880e00</id>
      <published>2019-06-30</published>
      <summary type="text">This is my CodeSystem</summary>
      <link rel="alternate" href="file:///data/myCodeSystem.json" type="application/fhir+json" />
      <ncts:contentItemIdentifier>http://example.com/CodeSystem/1</ncts:contentItemIdentifier>
      <ncts:contentItemVersion>1.0.0</ncts:contentItemVersion>
      <ncts:fhirVersion>4.0</ncts:fhirVersion>
  </entry>

  <entry>
      <title>My ValueSet</title>
      <category term="FHIR_ValueSet" label="FHIR Value Set" scheme="http://ns.electronichealth.net.au/ncts/syndication/asf/scheme/1.0.0" />
      <id>539a689f-cd46-4756-94be-29aed8544cb2</id>
      <published>2019-06-30</published>
      <summary type="text">This is my ValueSet</summary>
      <link rel="alternate" href="file:///data/myValueSet.json" type="application/fhir+json" />
      <ncts:contentItemIdentifier>http://example.com/ValueSet/1</ncts:contentItemIdentifier>
      <ncts:contentItemVersion>1.0.0</ncts:contentItemVersion>
      <ncts:fhirVersion>4.0</ncts:fhirVersion>
  </entry>
</feed>

We can then put our files in a directory structure such as

+ myOntoserver/
  - Dockerfile
  + data/
    - preload.xml
    - myCodeSystem.json
    - myValueSet.json

with a Dockerfile such as

FROM quay.io/aehrc/ontoserver:ctsa-6.1
COPY data/* data/

and, like option 1, change our docker-compose.yml file to use our new Docker image, by replacing

    image: quay.io/aehrc/ontoserver:ctsa-6.1

with

    build: myOntoserver

and running it with a build step, such as

docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d

3. Preload using a remote feed or multiple feeds

If it is necessary to use either remote syndication feeds, or multiple feeds, this can be done using the atom.preload.feedLocation configuration parameter.

This setting can be included in the docker-compose.yml file.

For example, we could add the following line to the environment section of our ontoserver container

    - atom.preload.feedLocation=https://acme.com/acme-terminology.xml,https://some.department.gov.au/fhir-resources.xml