Skip to content

Instantly share code, notes, and snippets.

@elementechemlyn
Last active July 13, 2021 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elementechemlyn/62df94b12267542ef359daa5d80e412b to your computer and use it in GitHub Desktop.
Save elementechemlyn/62df94b12267542ef359daa5d80e412b to your computer and use it in GitHub Desktop.

Fake PDS

Fake PDS is a copy of the NHS DIgitial PDS sandpit with data adjusted to suit the Maternity Hack. It contains two records:

Name Actor NHS Number Date of Birth
Alice Smith Mother 5400506275 2000-10-22
Emma Smith Baby 5815309540 2021-07-12

To Retrieve Alice's (the Mother) Fake PDS record:

curl -X GET "https://[base url]/Patient/5400506275" -H "accept: application/fhir+json" -H "NHSD-Session-URID: 555021935107" -H "X-Request-ID: 60E0B220-8136-4CA5-AE46-1D97EF59D068" -H "X-Correlation-ID: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA"

To Retrieve Emma's (The Baby) Fake PDS Record:

curl -X GET "https://[base url]/Patient/5815309540" -H "accept: application/fhir+json" -H "NHSD-Session-URID: 555021935107" -H "X-Request-ID: 60E0B220-8136-4CA5-AE46-1D97EF59D068" -H "X-Correlation-ID: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA"

To "Find" Alice's baby, use the related person endpoint to find a relation of type "CHILD":

curl -X GET "https://[base url/Patient/5400506275/RelatedPerson" -H "accept: application/fhir+json" -H "NHSD-Session-URID: 555021935107" -H "X-Request-ID: 60E0B220-8136-4CA5-AE46-1D97EF59D068" -H "X-Correlation-ID: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA"

To "Find" Emma's Mother, use the related person endpoint to find a relation of type "CHILD":

curl -X GET "https://[base url/Patient/5815309540/RelatedPerson" -H "accept: application/fhir+json" -H "NHSD-Session-URID: 555021935107" -H "X-Request-ID: 60E0B220-8136-4CA5-AE46-1D97EF59D068" -H "X-Correlation-ID: 11C46F5F-CDEF-4865-94B2-0EE0EDCC26DA"

Fake NEMS

Fake NEMS is a configured instance of the HAPI FHIR JPA Server with subscriptions eanbled. It supports the posting of message bundles to the Bundle endpoint and Subscriptions to the Subscription endpoint.

To create a subscription post a subscription resource to the Subscription endpoint: https://[base url]/fhir/Subscription

{
  "resourceType": "Subscription",
  "status": "requested",
  "criteria": "Bundle?type=message",
  "channel": {
    "type": "rest-hook",
    "endpoint": "http://example.com:8080/fhir",
    "payload": "application/json"
  }
}

The subscription will result in any Bundle of type message that is posted to fakeNEMS being http PUT to the endpoint http://example.com:8080/fhir/Bundle/[id] in json format.

[id] is an integer reflecting the id of the resource in fakeNEMS.

Message Bundles can be posted to the Bundle endpoint:

https://[base url]/fhir/Bundle

An example message bundle, showing a message indicating the a PHR has been provisioned and carrying two DocumentReference pointers: one to the FHIR endpoint for the POD and one to the "raw" pod API, can be found here:

https://gist.github.com/elementechemlyn/f5db8e94bbb547a87667d866a8cd1c02

A subscription exists on the server that will send message bundles containing DocumentReferences to a process that stores them in fakeNRL.....

Fake NRL

Fake NRL is a configured instance of the HAPI FHIR JPA server that can store DocumentReferences. DocumentReferences are loading into fakeNRL based on a subscription to fakeNEMS.

DocumentReferences that have been sent to fakeNRL via fakeNEMS can be searched via the DocumentReference endpoint:

https://[base url]/fhir/DocumentReference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment