Yeovil District Hospital NHSFT's SIDeR Contextual Link Obfuscation Service
This is Yeovil District Hospital NHSFT's contextual link obfuscation service, a Node.js application using the Fastify web framework and Black Pear's obfuscated-querystring.
This service was created out of a need for query string parameters containing personally identifiable data to be obfuscated when users click on the SIDeR contextual link within Yeovil District Hospital NHSFT's Patient Administration System (PAS), InterSystems TrakCare.
A video demonstrating the contextual link in action can be found here.
Single sign-on for a user using access tokens from a Keycloak server instance can be enabled using environment variables found in .env.template
.
These are only required if running the API outside of Docker:
Perform the following steps before deployment:
- Download and extract the latest release asset
- Navigate to the extracted directory
- Make a copy of
.env.template
in the root directory and rename it to.env
- Configure the application using the environment variables in
.env
Note Set the following environment variables in
.env
to meet NHS Digital's recommendation to retain six months' worth of logs:
LOG_ROTATION_DATE_FORMAT="YYYY-MM-DD"
LOG_ROTATION_FREQUENCY="daily"
LOG_ROTATION_MAX_LOGS="180d"
- Run
npm ci --ignore-scripts --omit=dev
to install dependencies - Run
npm start
The service should now be up and running on the port set in the config. You should see output similar to the following in stdout or in the log file specified using the LOG_ROTATION_FILENAME
environment variable:
{
"level": "info",
"time": "2022-10-24T09:07:09.513Z",
"pid": 25212,
"hostname": "MYCOMPUTER",
"msg": "Server listening at http:https://127.0.0.1:49217"
}
To test it, use Insomnia and import the example requests from ./test_resources/insomnia_test_requests.json
.
This requires Docker installed.
- Run
docker compose up
(ordocker compose up -d
to run in the background)
If you cannot deploy this into production using Docker, use a process manager such as PM2.
- Run
npm ci --ignore-scripts --omit=dev
to install dependencies - Run
npm i -g pm2
to install pm2 globally - Launch the application with
pm2 start .pm2.config.js
- Check that the application has been deployed using
pm2 list
orpm2 monit
If using a Microsoft Windows OS utilise pm2-installer to install PM2 as a Windows service.
Note PM2 will automatically restart the application if
.env
is modified.
API documentation can be found at /docs
:
This section is for members of the Solutions Development and Application Support teams at Yeovil District Hospital NHSFT, or other NHS Trusts that use InterSystems TrakCare as their PAS.
The SIDeR contextual link's icon profile values in TrakCare should be set to the following:
Link URL: <obfuscation service path>/redirect
Link expression: "&"_##class(Custom.ENYH.Integration.ContextualLink.GenericPatientLink).BuildURLVars("patient=https://fhir.nhs.uk/Id/nhs-number|{NHSNumber}&birthdate={DateOfBirthISO8601}&location=https://fhir.nhs.uk/Id/ods-organization-code|RA4&practitioner=https://sider.nhs.uk/auth|{UserName}@ydh.nhs.uk")
The icon itself can be found in the root of the images folder.
Contributions are welcome, and any help is greatly appreciated!
See the contributing guide for details on how to get started. Please adhere to this project's Code of Conduct when contributing.
- Anthony Smith (Chief Clinical Information Officer) - Contextual link logo design
- David Suckling (Application Support Manager) - Contextual link implementation and testing
- Mark Hunt - Keycloak single sign-on access tokens integration and testing
- Will Jehring - Query string obfuscation, redirect testing, and Keycloak testing
ydh-sider-obfuscation-service
is licensed under the MIT license.