Skip to content

Instantly share code, notes, and snippets.

@elementechemlyn
elementechemlyn / species_list.txt
Created August 30, 2023 16:14
Custom BirdNet-Analyzer species list for birds of Wales
Acanthis cabaret_Lesser Redpoll
Accipiter gentilis_Northern Goshawk
Accipiter nisus_Eurasian Sparrowhawk
Acrocephalus schoenobaenus_Sedge Warbler
Acrocephalus scirpaceus_Eurasian Reed Warbler
Actitis hypoleucos_Common Sandpiper
Aegithalos caudatus_Long-tailed Tit
Aix galericulata_Mandarin Duck
Alauda arvensis_Eurasian Skylark
Alca torda_Razorbill
{
"resourceType": "Bundle",
"id": "3",
"meta": {
"versionId": "1",
"lastUpdated": "2021-07-08T15:45:11.974+00:00",
"source": "#BVurnbOFH97DS1W0",
"profile": [ "http://hl7.org/fhir/STU3/StructureDefinition/Bundle" ]
},
"type": "message",

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:

@elementechemlyn
elementechemlyn / PDS FHIR Sandbox pip
Created June 11, 2021 10:45
Python requirements to run the NHS PDS FHIR API Sandbox locally
appdirs==1.4.4
CacheControl==0.12.6
cachy==0.3.0
certifi==2021.5.30
cffi==1.14.5
chardet==4.0.0
cleo==0.8.1
clikit==0.6.2
crashtest==0.3.1
cryptography==3.4.7

Pointer Resolution Notes

A set of examples of retrieving the contents of a fully contained NEMS message from a pointer passed in a lightweight NEMS message. These examples all use search functionality as described in the base HL7 FHIR spec:

https://www.hl7.org/fhir/STU3/search.html

Examples Setup

To setup these examples, the transactional bundle found here:

<Bundle xmlns="http://hl7.org/fhir">
<id value="6e824ff8-9b0a-11e8-9eb6-529269fb1459"/>
<meta>
<profile value="http://hl7.org/fhir/STU3/StructureDefinition/Bundle"/>
</meta>
<type value="transaction"/>
<entry>
<fullUrl value="urn:uuid:076db265-8799-4dda-9418-e2a4d6d1c0d0"/>
<resource>
<Immunization>
Install OpenVPN. Must be Community version (otherwise get "TAP not supported" error). Service not required.
Import ovpn profile.
Find NEMS Party Key (not required uses the Spine party key: found here:https://digital.nhs.uk/services/path-to-live-environments/spine-core-common-issues-in-the-path-to-live-environments)
ldapsearch -x -H ldap://192.168.128.11 -b "ou=services, o=nhs" "(&(nhsIDCode=YES) (nhsAsSvcIA=urn:nhs:names:services:clinicals-sync:SubscriptionsApiPost))" uniqueIdentifier nhsMhsPartyKey
Lookup Message handling endpoint for Subscription Post:
ldapsearch -x -H ldap://192.168.128.11 -b "ou=services, o=nhs" "(&(nhsMhsPartyKey=[PARTY KEY GOES HERE]) (objectClass=nhsMhs) (nhsMhsSvcIA=urn:nhs:names:services:clinicals-sync:SubscriptionsApiPost))" nhsMhsEndPoint
Lookup Message handling endpoint for Subscription Read:
@elementechemlyn
elementechemlyn / meshapi.py
Last active September 10, 2020 16:11
Quick Python script to demo calling the NHS MESH API
import requests
import uuid
import datetime
import hmac
import hashlib
import logging
#This is the set of headers required for an authenticate request.
MESH_HEADERS = {
"Authorization":"",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function meshAuthorisationToken (mailboxId, mailboxPassword, secretKey) {
// GS 2016-12-13
// construct MESH authorisation token
var d = new Date();
var ts = '' + d.getFullYear()
+ (d.getMonth() < 9 ? '0' + (d.getMonth()+1) : (d.getMonth()+1))
+ (d.getDate() < 9 ? '0' + (d.getDate()) : (d.getDate()))
+ (d.getHours() < 10 ? '0' + d.getHours() : d.getHours())
+ (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes());