Skip to content

Instantly share code, notes, and snippets.

View madaster97's full-sized avatar

Adam Strickland madaster97

  • Epic Systems Corporation
  • Verona, WI
View GitHub Profile
@madaster97
madaster97 / README.md
Last active July 29, 2021 17:56
Batch/Include tags for fhir subscriptions

Here's my take on handling batched notifications and included resources in id-only notifications.

  1. Whenever you batch multiple events in a notification you NEED to include a "focus" in the header, since you could for instance have the same resource show up multiple times in the header.
  2. Whenever you have _include resources in the bundle, you need to tag that entry saying that (in addition to maybe being the focus based on "focus") you are including it for a specific event. IE, rather than tagging what resoure this was included from, you tag the event ID (which has 1 focus resource we now know this was included for).

I have 4 examples attached showing different notification use cases: Simple -> Encounter1 Include -> Encounter2 includes Encounter1 Batch -> Encounter1, Encounter2, Encounter1 Batch and Include -> Encounter 2 includes Encounter1, Encounter1

@madaster97
madaster97 / index.js
Last active February 19, 2021 03:39
Deflate SHC by Gzip
const zlib = require('zlib');
const Got = require('got').default;
const { promisify } = require('util');
const gzipRaw = promisify(zlib.gzip);
const minifiedUrl = 'https://smarthealth.cards/examples/example-00-c-jws-payload-minified.json';
async function deflateByGzip(string) {
const gzipped = await gzipRaw(string);
return gzipped.slice(10, gzipped.length - 8);