Giter Club home page Giter Club logo

kf-api-fhir-service's People

Contributors

alubneuski avatar blackdenc avatar dependabot[bot] avatar fiendish avatar liberaliscomputing avatar znatty22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kf-api-fhir-service's Issues

Add CircleCI pipeline & basic tests

Since others may start to use the Smile CDR server and the utility scripts in this repo, we should add some tests to make sure things work.

This adds CircleCI pipeline to test new smile CDR deploys and server settings updates. Test will be very simple to start - load KF FHIR model, example data, and curl a FHIR endpoint. Later on the simple FHIR tests will be replaced with integration tests that are developed as a part of the kf-model-fhir repo.

Later on a Jenkins pipeline will be added so that the FHIR service is deployed to the standard AWS KF environments with the standard ecs-service-type-1 infrastructure. It is still important to keep the CircleCI pipeline since other developers outside of KF (without access to Jenkins) can use this repo with CI in place.

The valueset search parameter does not work

Filing here for awareness. This ticket is still open. https://smilecdr.freshdesk.com/support/tickets/294

We’re having trouble searching for StructureDefinitions by the valueset search parameter.

First query http://10.10.1.191:8000/StructureDefinition/Patient to verify that it’s snapshot has an element with a binding to the languages ValueSet
Next query http://10.10.1.191:8000/ValueSet/languages to verify that the value set exists
Last try the query we really want: http://10.10.1.191:8000/StructureDefinition/Patient?valueset=languages

That last query always returns 0 results. My understanding of the valueset search parameter is that it searches the list of elements in the resource snapshot, and for any element that has a binding, it will check to see if that binding’s valueset matches the one in the query.

Write non-secret prod settings as ENV in docker image

Production settings that are not secrets should be written into the prod docker image so that they can be controlled from this repository. Right now if you make changes to prod.env, they don't take effect in the deployment, since the deployment pipeline sets environment variables using .env files stored in S3.

  • Write non-secrets in server/settings/prod.env as ENV in Dockerfile
  • Remove these settings from the .env files on S3
  • Remove server/settings/prod.env

Prepare for PRD deployment

Optional

  • Setup reverse proxies for FHIR API, Admin API, Admin Dashboard and test it with nginx
  • Test out Smile CDR's APM service for application perf monitoring (?)

Secure the server with TLS

Part of d3b-center/clinical-data-flow#37

In order to deploy the smile CDR server to production we will need to secure it in several ways. Right now all smile endpoint ports have inbound rules in the firewall and none of the requests are encrypted.

We should setup a reverse proxy from ports 80, 443 to all smile CDR endpoints so that we can remove inbound rules for all ports except 80 and 443 in firewall. The reverse proxy will also make it easier to remember all of the endpoints (<host>/fhir_api is easier to remember than <host>:8000) Then we can setup TLS on the reverse proxy so all http traffic coming into the internal network is encrypted.

(We could also encrypt all traffic from the reverse proxy to smile CDR since smile CDR implements TLS but this may be overkill for an internal data service)

In preparation for this, we can add NGINX to the docker stack and test smile CDR to make sure everything works as expected with the reverse proxy and TLS.

  1. Add NGINX to docker stack
  • Remove inbound firewall rules for all http ports except 80 and 443
  • Setup reverse proxy (443 -> 9000, 9100, 8000, 8001) for all smile CDR endpoints
  • Secure nginx endpoint with TLS (1.2 or 1.3 not sure yet)
  1. Update appropriate configuration (respect forward headers) on smile CDR

  2. Test FHIR data dashboard and FHIR ingest

Snapshot generation only works on profiles that extend FHIR base types

This is likely a bug in Smile CDR. Issue filed here: https://smilecdr.freshdesk.com/support/tickets/364

Details

  • A StructureDefinition (e.g. kfdrc-patient) which extends a FHIR base StructureDefinition (e.g. Patient) seems to have a valid snapshot that was generated (verified using /StructureDefinition/kfdrc-patient/$snaphost)
  • A StructureDefinition (e.g. kfdrc-patient-no-phi) which extends kfdrc-patient does not have a snapshot (verified using /StructureDefinition/kfdrc-patient-no-phi/$snaphost)

Harden and re-deploy

  • Replace temporary secrets with real ones and re-deploy
  • Turn on validation after deploy via admin endpoint
  • Grant anonymous user CRUD access to all non-conformance FHIR resources
  • Create users for team members

No way to tell when search parameter re-indexing completes

When a SearchParameter is submitted to the server, the server must re-index all of the resources for the parameter before a query using that search parameter can work.

The re-indexing can take several minutes and there is no reliable way to tell when the server is finished with re-indexing. Right now the logs must be inspected to determine when indexing finishes. When there are no more log statements saying 0 concepts to index, then the server has complete indexing.

Use Smile CDR docker image on AWS ECR

Our production deployment will require the Smile CDR image to be in its own repo on ECR. We need to update the Dockerfile to use this image rather than the one hosted on Dockerhub.

The compose stack is for local development and doesn't need to use the production docker image so we will also need to update the docker-compose file to use the image on Dockerhub rather than the image built from the Dockerfile.

Change DB env var names to match ecs-service-type-1 generated ones

The ecs-service-type-1 deployment creates the service's database as part of the service deployment. It also writes the DB secrets to an database.env file in the appropriate S3 bucket.

The Smile CDR properties file, docker-compose.yml, and dev.env files should same env var names for DB secrets so that these vars can be sourced from the ecs-service-type-1 generated database.env file.

Integrate server with Auth0

The smile CDR server is currently setup with basic authentication using the internal smile CDR users database.

We eventually want to augment this setup (or move away from it entirely) with an OIDC setup where smile CDR doesn't have to authenticate users itself. Users should be able to use Google to sign in.

Integrating with Auth0 will allow us to do this (among other useful things) and make user management a lot easier. This would also setup smile CDR so that authorization (RBAC) could also be managed with Auth0 rather than smile CDR.

Add integration test server

Create a version of the Smile CDR server (docker image) suitable for FHIR model integration tests. This server will be spun up for use during integration tests of kf-model-fhir.

The integration test server will use the embedded H2 database instead of an external Postgres database and should have all of the base FHIR model loaded in it so that server startup is minimal.

The integration test server image will be stored in ECR and Dockerhub and will be updated whenever a new release of Smile CDR comes out or the test target in the Dockerfile changes.

Upgrade to Postgres 11

Supposedly Smile CDR supports Postgres 11. If this is the case, we should upgrade to it. We are currently on the Postgres 9.4 which is the default Postgres version that Smile CDR supports

Use properties file as settings source of truth

Initially it was thought that the properties file could only be used to configure the server on the first deployment and thereafter the admin API had to be used to update and persist server settings.

This was a misconception. The properties file can always be used as the source of truth IF the
node.propertysource setting is set to PROPERTIES. This eliminates the need for the load_settings.py script which was reading the properties file and updating server configuration thru the admin API.

Dockerhub repo should be primary source for smilecdr img

Update the line in the README about getting access to the smilecdr docker image. Users need a docker hub account and should be added as a collaborator to the docker hub repo.

Consider using an internal docker repo like AWS ECR so that any Kids First developer with access to the KF AWS account can pull the image after logging in. This way they don't need to create a Dockerhub account if they don't have one.

Make seed conformance resources setting config from env

Not all deployments of the Smile CDR server will need to seed the server with the base FHIR conformance resources.

This setting should be configurable from the environment so that in prod it can be turned off for all deployments after the first one.

Upgrade to new release 2020.05.R01 (Labrador)

The new Smile CDR release has a number of improvements, one being snapshot generation. We were told that upgrading to this release may resolve issues #35 and #30.

  • Run merge_properties.py script to check for settings updates
  • Update master.properties with any new settings
  • Run update_smilecdr.sh script to update container registries
  • Update Dockerfile with new tag
  • Update docker-compose.yml with new tag

Deploy FHIR data model to the server via a fhir npm package

FHIR data models consist of conformance resources from 0 or more other data models. More specifically, a FHIR data model is distributed as an npm package, where the package can have dependencies which are other FHIR packages.

Since the FHIR package spec is still in development there is no tool that is able to build a complete FHIR package - aka collect all conformance resources in the fhir package and all of its dependent packages.

Once this functionality is implemented, the loader script should be updated to deploy (POST to the server) the conformance resources from a complete FHIR package.

Seed server with conformance resources at startup

Prior to 2020 docker images, the conformance resources were always created automatically. Starting with 2020.02, this functionality was turned off by default but can be turned ON again by enabling the parameter "Seed Base Validation Resources" in Smile CDR.

We should turn this feature on so that server deploys are always populated with the FHIR R4 base model.

Add deployment config repo

If not already done, add a deployment config GH repo which will contain the infra configuration and the Jenkins CI pipeline inputs. Will likely only need to define the test stage.

Server fails resource validation due to ValueSets not pre-expanded

The docs for Smile CDR say that the server is finished deploying when the statement Smile, we're up and running :) is logged. This is misleading because the server will fail resource validation if a resource is submitted that makes use of a code in a ValueSet that has not yet been "pre-expanded" by the server. Smile CDR takes a minute or two to "pre-expand" or index codes in the HL7 ValueSets after it is deployed.

There doesn't seem to be an adequate way to determine when the server is finished pre-expanding ValueSets.

This could potentially be solved in the new release. We should try the new release out to see if it fixes this.

Add Jenkinsfile

Create a Jenkinsfile so that the FHIR service is picked up by Jenkins to be deployed to the standard AWS dev, qa, prd environments.

Logger exception on /endpoint-health

An exception is thrown by the logger filter whenever the logger logs an HTTP request to the health check endpoint /endpoint-health

21:04:06.166 [fhir_endpoint.fhirEndpointServer-127] INFO  kidsfirstdrc.fhir_endpoint.access - 2020-06-23T21:04:06.157Z GET /endpoint-health HTTP/1.1 200
21:04:06.165 [fhir_endpoint.fhirEndpointServer-127] ERROR ca.cdr.api.web.ExceptionLoggerFilter - Failure during processing

This doesn't cause the server to go down, however it clutters the log a lot and makes it difficult to visually inspect.

Create FHIR 101 Demo + Guide

Every team member should have a practical understanding of basic FHIR concepts:

  • How are entities and their attributes represented in FHIR
  • How to model things - add/remove entity attributes, change entity relationships, and change constraints on relationships and attributes
  • How to make entity attributes searchable
  • How to represent entity attributes in various ontologies

Dockerize the service

In order to use the ECS Type 1 deployment, we need to provide a Dockerfile to the deployment process. The Dockerfile will simply extend the Smile CDR image and add the necessary default server settings. Production settings will be passed in through the environment and override the default settings.

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.