Code Monkey home page Code Monkey logo

medserve's Introduction

CircleCI

Medserve

Medserve is an experimental FHIR server prototype which serves up Medication, Substance and Organisation resources built from terminology and other data sources. At present it serves a set of Medication resources which are built from AMT with PBS data blended in. Future plans involve importing TGA data, dm+d and RxNorm.

Medserve is currently not part of any production infrastructure.

Medserve has been built to explore the idea of presenting medicines terminologies (AMT, dm+d, RxNorm...etc) via a common API (FHIR). This is intended to make it easier

  • to implement each individually through an API rather than starting from native file formats and building supporting infrastructure
  • and to implement multiple medicines terminologies because there is a common API to each of them

Feedback is very much appreciated to help guide where this project should go - please raise an issue with any feedback on the concept, implementation, API etc.

How to run it

You can run Medserve from prebuilt Docker images on Docker Hub built from master by CircleCI. There is a Docker Compose file in the ./server directory you can use to start up Medserve with its website and Polecat browser.

Building it yourself

Building the containers yourself isn't hard. Prequisites include the JDK (obviously), Maven and Docker.

Clone the repository and run

mvn install -Dsynd.client.id=your_client_id -Dsynd.client.secret=your_client_secret -Dsynd.cache.dir=/path/to/keep/terminology/files

This will build and locally install the Docker images, you will need a set of client credentials to download content from the NCTS as this process will download the latest version of AMT and the PBS. Refer to https://www.healthterminologies.gov.au/specs/v2/national-services/api-security for more details on getting client credentials.

You'll also need to specify where to download these files to, which if available between runs will be consulted before new files are downloaded and can speed up the process.

To make execution easier (if you're not too paranoid) you can set these values into environment variables - e.g.

export SYND_CACHE_DIR=/path/to/keep/terminology/files
export SYND_CLIENT_ID=your_client_id
export SYND_CLIENT_SECRET=your_client_secret

Then you can simply run

mvn install

API

The API exposed is currently best described by the Postman collection

medserve's People

Contributors

dependabot[bot] avatar dionmcm avatar johngrimes avatar stav09 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

medserve's Issues

Parameterise AMT snapshot and PBS extract file locations

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


Currently the configuration for the index-builder in the fhir-server POM includes this:

<configuration>
  <amtSnapshot>/Users/dion/NCTS_SCT_RF2_DISTRIBUTION_32506021000036107-20170831-SNAPSHOT.zip</amtSnapshot>
  <pbsExtract>/Users/dion/2017-09-01-extracts.zip</pbsExtract>
</configuration>

We should populate these using parameters so that we can change them without editing the POM.


Configure hostname (with port) used in hypermedia links?

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


Is there a way to configure Medserve to use a specific hostname within hypermedia links, such as link.next?

Specifically, I want to be able to prevent it from giving me back links like this:

http://medserve.local/fhir?_getpages=cf53388a-c6b4-4491-820b-04ab3da53a3f&_getpagesoffset=100&_count=100&_bundletype=searchset

When I am actually running Medserve on port 8090. I need the link to look like this:

http://medserve.local:8090/fhir?_getpages=cf53388a-c6b4-4491-820b-04ab3da53a3f&_getpagesoffset=100&_count=100&_bundletype=searchset


PBS data not present

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


There doesn't seem to be PBS data on medserve.online, dionmcm/medserve, or my locally built copy.

At least, the example for searching by subsidy code in the Postman collection doesn't return anything, and searches of other PBS codes seem to yield the same result.


Serve structure definitions for extensions

Medserve should serve structure definitions for its extensions. This was intended to be done by HAPI generating this off the annotated Java classes that Medserve uses for its extensions...but this doesn't seem to work at present.

More analysis and work with the HAPI community is needed to see if this can be done, or if not another solution is required. Ideally the definitions would be generated from the Java code as that is the code that Medserve uses to create the resources and is far better than having a manually created set of resources which can get out of step.

Deployment broken due to build option in docker-compose.yml

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


Deployment is currently broken due to these:

https://bitbucket.org/dion_mcmurtrie/medserve/src/06fe045a876c21927c4bfab5741987dab9b7c481/server/docker-compose.yml?at=master&fileviewer=file-view-default#docker-compose.yml-5

Docker Compose looks for the sub-directories that these refer to, and fails when it doesn't find them. Passing --no-build to docker-compose up doesn't seem to help.


DataFormatException: Invalid date/time format

Originally reported by Dion McMurtrie (Bitbucket: dion_mcmurtrie, GitHub: Unknown)


https://sentry.io/dion-mcmurtrie/medserve/issues/447174832/

DataFormatException: Invalid date/time format: "201731": Expected character '-' at index 4 but found 3
    at ca.uhn.fhir.model.primitive.BaseDateTimeDt.throwBadDateFormat(BaseDateTimeDt.java:654)
    at ca.uhn.fhir.model.primitive.BaseDateTimeDt.validateCharAtIndexIs(BaseDateTimeDt.java:705)
    at ca.uhn.fhir.model.primitive.BaseDateTimeDt.parse(BaseDateTimeDt.java:350)
    at ca.uhn.fhir.model.primitive.BaseDateTimeDt.parse(BaseDateTimeDt.java:39)
    at ca.uhn.fhir.model.api.BasePrimitive.setValueAsString(BasePrimitive.java:111)
...
(52 additional frame(s) were not displayed)

Failure during REST processing: ca.uhn.fhir.parser.DataFormatException: Invalid date/time format: "201731": Expected character '-' at index 4 but found 3

Extension documentation

Greater documentation of the extensions, their purpose, meaning etc is required. Ideally this could be generated from the HAPI annotated Java classes, or the structure definitions generated from that. That is the ideal location for this documentation.

Failing that another approach may be necessary - a markdown file in the source?

Filter by parent and resource type

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


Is there a way to do a search specifying both parent and resource type?

curl -v 'http://localhost:8080/fhir/Medication?parent=Medication%2F21433011000036107&medicationResourceType=UPDSF'
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /fhir/Medication?parent=Medication%2F21433011000036107&medicationResourceType=UPDSF HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: nginx/1.13.5
< Date: Sun, 22 Oct 2017 23:07:29 GMT
< Content-Type: application/fhir+json;charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: HAPI FHIR 2.4 REST Server (FHIR Server; FHIR 3.0.1/DSTU3)
<
* Connection #0 to host localhost left intact
{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[Medication] with parameters [[parent, medicationResourceType]]"}]}

This would be useful for getting the children of a concept broken down by type, without having to wade through and filter large amounts of search results on the client side.

For example, how do I get child MPUUs for an MP?


Add TGA PMI, CMI and product summary links

Expected behaviour

  • TGA product summary, PMI and CMI links should be in the resource

Actual behaviour

  • these are available in the TGA data but not present in the resources

Change isReplacedByResources to isReplacedBy, replacesResources with replaces

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


This is what the extension structure currently looks like:

Medication
|- isReplacedByResources
|  |- isReplacedBy
|  |- replacementType
|  |- replacementDate
|-...
|- replacesResources
|  |- replacesResource
|  |- replacementType
|  |- replacementDate
|-...

This should be done in the same way as subsidy, and re-jigged to look like this:

Medication
|- isReplacedBy (valueReference)
|  |- replacementType
|  |- replacementDate
|-...
|- replaces (valueReference)
|  |- replacementType
|  |- replacementDate
|-...

Get request for Medication resources returns json+fhir not fhir+json

Originally reported by Dion McMurtrie (Bitbucket: dion_mcmurtrie, GitHub: Unknown)


Strangely requests for everything on the server

  • searches returning bundles
  • get requests for Organization resources
  • get requests for Substance resources

All return application/fhir+json as expected for STU3 except for get requests for Medication resources by identifier, which return application/json+fhir.

Very strange, needs investigation...


Add snapshot testing

Testing the AMT transformation to FHIR is hard, one cheap way to do this is snapshot testing, where the resources can be generated against a known data set and stored. They can then be regenerated and compared at build time to determine if changes have occurred.

Jest provides a good way to do this, something similar in concept is needed https://facebook.github.io/jest/docs/en/snapshot-testing.html

Note this isn't comprehensive testing, but a cheap step forward once the transform attains decent stability (i.e. the target stops moving so much!)

TLS support

Originally reported by John Grimes (Bitbucket: j0hngr1mes, GitHub: Unknown)


Serving Medserve using plain HTTP has a couple of problems:

  • Browser-based clients hosted using TLS are unable to make requests to it, due to security restrictions in the browser.
  • Some web APIs are disabled within insecure contexts, such as the WebCrypto API, which Polecat uses internally to generate random unique identifiers.

This is in addition to the usual problems associated with serving over HTTP, which include:

  • The potential for content-hijacking.
  • Negative influence on search engine rankings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.