Skip to content

Commit

Permalink
Add Docu
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkiel committed Mar 29, 2019
1 parent 01b318c commit 891af25
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!fhir
!src
!Dockerfile
!project.clj
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
FROM clojure:lein-2.8.1 as build

COPY . /build/

WORKDIR /build
RUN lein uberjar

FROM openjdk:8u191-jre-alpine3.9

COPY target/life-fhir-store-0.1-SNAPSHOT-standalone.jar /app/
COPY fhir /app/
COPY --from=build /build/target/life-fhir-store-0.1-SNAPSHOT-standalone.jar /app/
COPY fhir /app/fhir/

WORKDIR /app

Expand Down
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,82 @@
# Life FHIR Store
# LIFE FHIR Store

A FHIR Store including a CQL Engine based on Datomic.

## Usage

FIXME
You need Docker to run the LIFE FHIR Store. The most convenient way is to check out this repository and use the `docker-compose.yml` to bring the LIFE FHIR Store up. The default memory requirements are 4 GB. You also need to have port 8080 free on your host.

To start the LIFE FHIR Store, type:

```bash
docker-compose up
```

You should see a output similar to:

```
Creating volume "life-fhir-store_db-data" with default driver
Recreating life-fhir-store_db_1 ... done
Recreating life-fhir-store_store_1 ... done
Attaching to life-fhir-store_db_1, life-fhir-store_store_1
db_1 | Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
db_1 | Starting datomic:free://0.0.0.0:4334/<DB-NAME>, storing data in: /data ...
db_1 | System started datomic:free://0.0.0.0:4334/<DB-NAME>, storing data in: /data
store_1 | 19-03-29 08:57:48 52816fd744d6 INFO [life-fhir-store.system:110] - Read structure definitions from: /app/fhir/r4 resulting in: Address, Annotation, Period, CodeableConcept, Organization, Encounter, Specimen, Bundle, Coding, Patient, Range, ContactPoint, Meta, Quantity, HumanName, DeviceMetric, SampledData, Ratio, Device, Reference, Identifier, Narrative, Observation
store_1 | 19-03-29 09:13:09 bc25669b9f17 INFO [life-fhir-store.system:90] - Created database at: datomic:free://db:4334/dev
store_1 | 19-03-29 09:13:09 bc25669b9f17 INFO [life-fhir-store.system:93] - Connect with database: datomic:free://db:4334/dev
store_1 | 19-03-29 09:13:10 bc25669b9f17 INFO [life-fhir-store.system:98] - Upsert schema in database: datomic:free://db:4334/dev creating 2300 new facts
store_1 | 19-03-29 09:13:10 bc25669b9f17 INFO [life-fhir-store.server:33] - Start server on port 8080
store_1 | 19-03-29 09:13:10 bc25669b9f17 INFO [life-fhir-store.core:49] - Maximum available memory: 2048
store_1 | 19-03-29 09:13:10 bc25669b9f17 INFO [life-fhir-store.core:50] - Number of available processors: 4
```

In order to test connectivity, you can query the health endpoint:

```bash
curl http://localhost:8080/health
```

It should return `OK`.

### Upload FHIR Resources

before you can issue CQL queries against the LIFE FHIR Store, you have to upload some FHIR resources. If you have none, you can generate them y using the [FHIR Test Data Generator][1].

```bash
life-fhir-gen -n1 > bundle.json
```

Next you need to upload that `bundle.json` to the LIFE FHIR Store:

```bash
curl -d @bundle.json http://localhost:8080/fhir
```

The result should be:

```
{"message":"OK","t":<some number>}
```

### Issuing a CQL Query

The most convenient way is to use the [CQL Runner][2]. You have to go into the `Config` menu and set the `CQL Engine` to `http://localhost:8080/cql/evaluate`. The other config options doesn't matter because the CQL Engine of the LIFE FHIR Store always uses its own internal data.

### Deleting the Data Volume

If you like to restart with a fresh database, you have to delete the data volume. You can do this by typing:

```bash
docker volume rm life-fhir-store_db-data
```

## License

Copyright © 2019 LIFE Research Center (Alexander Kiel)

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

[1]: <https://github.com/life-research/life-fhir-gen>
[2]: <http://cql-runner.dataphoria.org/>
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.2'
services:
db:
image: "akiel/datomic-free:0.9.5656"
environment:
ALT_HOST: db
volumes:
- "db-data:/data"
store:
image: "f471ce7b017d"
environment:
DATABASE_URI: "datomic:free://db:4334/dev"
STRUCTURE_DEFINITIONS_PATH: "/app/fhir/r4"
JVM_OPTS: "-server -Xms2g -Xmx2g -XX:+UseG1GC"
ports:
- "8080:8080"
depends_on:
- db
volumes:
db-data:

0 comments on commit 891af25

Please sign in to comment.