Skip to content

Architecture

Pascal Brandt edited this page Aug 5, 2020 · 6 revisions

Overview

The workbench deployment consists of a number of containers that together compromise the application. Each of the components is briefly described here.

cqf-ruler

The CQF Ruler is an implementation of the FHIR Clinical Reasoning Module. It is essentially a HAPI FHIR server with a built-in CQL engine. It stores FHIR resources in the deployed PostgreSQL instance. CQL is evaluated by submitting a payload to the $cql extended operation (see here for the full payload format). For example:

curl 'https://workbench.phema.science:4321/fhir/$cql' \
  -H 'Content-Type: application/json' \
  --data-binary '{"resourceType":"Parameters","parameter":[{"name":"code","valueString":"define _: 1 + 1"}]}'

Workbench API

The Workbench API is the API backend for the PhEMA Workbench. It is a RESTful API server written in Java, and includes cql-on-omop and elm-utils as dependencies.

Currently, there are endpoints for running cql-on-omop, translating CQL to ELM, and generating a Graphviz DOT representation of a CQL library. The Workbench API is still in the early phases of development. More documentation to follow.

Workbench App

The Workbench App (code in this repository) is the part of the PhEMA Workbench that runs in the browser. It is primarily written in TypeScript and React, and the code is arranged in a monorepo using a Yarn workspace. See the main readme for more information. All packages are contained in the /packages directory. The packages are briefly described below.

Connection Manager

The connection-manager package contains the code responsible for adding and viewing server connections (editing and deleting are still TODO). The interface for the ConnectionManager React component is:

interface ConnectionManagerProps {
  connections: Connections;
  setConnections: (connections: Connections) => void;
}

See all package type definitions here.

CQL Editor

The cql-editor package exports the CQL code editor component, which uses Monaco.

FHIR Utils

The fhir-utils package contains utilities for working with FHIR servers and data.

Phenotype Visualizer

The phenotype-visualizer package contains the very early stages of the browser part of the phenotype visualization code.

Terminology Manager

See dedicated wiki page.

Terminology Utils

The terminology-utils package contains utility functions for working with FHIR terminologies and OMOP concept sets.

Workbench App

The workbench-app is the main entry point. It contains the main outer component mounted into the DOM.

Workbench Common

The workbench-common package contains components that are shared between multiple other packages.

CORS Proxy

The CORS proxy is an instance of cors-anywhere and is mainly to support querying the VSAC FHIR server, which unfortunately is not correctly configured to handle cross-origin requests.

To use the CORS proxy, just add the desired URL as a suffix in the request:

fetch('https://cors.phema.science:4321/http://cts.nlm.nih.gov/fhir')
  .then(response => console.log(response))

Workbench Ingress

The ingress is a simple Nginx reverse proxy that forwards requests to the appropriate service depending on the URL.