Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
CDS Hooks implementation and a complete refactor of the modularity of…
Browse files Browse the repository at this point in the history
… the app
  • Loading branch information
jdjkelly committed Jun 28, 2021
1 parent 0ba96d7 commit 0569a0f
Show file tree
Hide file tree
Showing 41 changed files with 4,034 additions and 910 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
example
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'eslint-plugin-tsdoc'
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
"tsdoc/syntax": "warn"
},
env: {
node: true
}
};
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules/
node_modules/
dist/
# config for fly.io version used for public conformance testing
fly.toml
.DS_Store
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 14.17.1
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:16-alpine AS packages

ADD package.json /app/package.json

WORKDIR /app

# Installing packages witout devDependencies
RUN npm install --only=prod

FROM packages

ADD . /app

# Building TypeScript files
RUN npm run build

EXPOSE 8080

CMD ["npm", "start"]
94 changes: 86 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,100 @@
# fhir.ts
# Serotiny

fhir.ts is an unnamed FHIR implementation targeting all three major definitions with Rust and TypeScript:
Serotiny is a modular TypeScript toolchain for FHIR (and friends).

- [ ] FHIR Document support through persistence, typing, and validation tools
- [ ] FHIR REST API support through configurable server
- [ ] HTTP client and server
- [ ] GraphQL
- [ ] FHIR Messaging support
Health data is spreading everywhere. FHIR is a big part of that. Serotiny is built for developers who need tools in the languages they know, with opinionated answers to solve common problems.

It currently has no published build.
Features:
- A broken [FHIR](https://www.hl7.org/fhir/http.html) [REST](#rest)ful API implementation of base resources
- A non-existence [FHIR] GraphQL API implementation of base resources
- Actually good [CDS Hooks](#cds-hooks) Service support
- Modular design so that you can run 1 service or many
- In-memory persistence (please don't actually use this)
- Out of box typings support for FHIR R4 with generics

We're thinking about:
- SMART Apps/Launching
- Access control
- Building a Validator so
- CQL
- Profile support
- Deployment configurations
- Subscriptions/Streams

## Docs
* [Quick Start](#quick-start)

## Quick Start

`

## REST

Serotiny exposes a `Rest` service that

## CDS Hooks

Serotiny exposes `Service` and `Card` classes which can be used from the `@sero/cds-hooks` module.

"CDS Hooks" are a protocol separate from FHIR proper, but involve the use of its data structures.

Serotiny automatically scaffolds all of the necessary API routes in the spec when you create a new Service, and exposes a simple, typed function that executes on `hookRequest` events.

Building support for this protocol as a distribution/access channel for novel clinical decision making techniques is super easy with Serotiny. Because of its modular design, CDS Hooks can be run as a totally standalone service: `example/cds-hooks.ts` shows an instance of Serotiny in this configuration.

### Conformance notes
- Discovery service call
- Loading Services from `PlanDefinition` is not currently possible
- Currently passes Touchstone with a warning

### Example

```typescript
import { Service, Card } from "@sero/cds-hooks";

interface PatientPrefetch {
patient: fhir4.Patient;
}

export default new Service(
{
title: "Echo service",
hook: "patient-view",
description: "A demo service",
prefetch: {
patient: "Patient/{{context.patientId}}"
}
},
(request: CDSHooks.HookRequest<PatientPrefetch>) => {
const { patient } = request.prefetch;

return {
cards: [
new Card({
detail: "CDS Card Response",
source: {
label: "Serotiny Server",
},
summary: "Info"
})
]
}
}
)
```

## Progress

- Support for /metadata and the Conformance/CapabilityStatement retrieval is working
- Mocked functions for the instance level, type level, and system level REST APIs
- CDS Hooks
- https://www.hl7.org/fhir/clinicalreasoning-cds-on-fhir.html
- https://cds-hooks.org/

## Contributing



```
npm install
npm run watch
Expand Down
7 changes: 0 additions & 7 deletions dist/cli/index.js

This file was deleted.

112 changes: 0 additions & 112 deletions dist/http.js

This file was deleted.

7 changes: 0 additions & 7 deletions dist/index.js

This file was deleted.

22 changes: 0 additions & 22 deletions dist/metadata.js

This file was deleted.

Loading

0 comments on commit 0569a0f

Please sign in to comment.