Skip to content

Commit

Permalink
Merge pull request #182 from NHSDigital/feature/DMS-1195-Flu-function…
Browse files Browse the repository at this point in the history
…ality

added Flu response to api
  • Loading branch information
jalcock501 committed May 4, 2023
2 parents 82a7538 + 0c4f274 commit 4fedbc2
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check ticket name conforms to requirements
run: echo ${{ github.event.pull_request.head.ref }} | grep -i -E -q "(release/[0-9]{4}-[0-9]{2}-[0-9]{2})|(dala-[0-9]+)|(apm-[0-9]+)|(apmspii-[0-9]+)|(adz-[0-9]+)|(dependabot\/)"
run: echo ${{ github.event.pull_request.head.ref }} | grep -i -E -q "(release/[0-9]{4}-[0-9]{2}-[0-9]{2})|(dala-[0-9]+)|(apm-[0-9]+)|(apmspii-[0-9]+)|(adz-[0-9]+)|(dms-[0-9]+)|(dependabot\/)"

- name: Grab ticket name
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-')
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'DMS-')
run: echo ::set-env name=TICKET_NAME::$(echo ${{ github.event.pull_request.head.ref }} | grep -i -o '\(apm-[0-9]\+\)\|\(apmspii-[0-9]\+\)\|\(adz-[0-9]\+\)' | tr '[:lower:]' '[:upper:]')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Comment on PR with link to JIRA ticket
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-')
if: contains(github.event.pull_request.head.ref, 'apm-') || contains(github.event.pull_request.head.ref, 'APM-') || contains(github.event.pull_request.head.ref, 'apmspii-') || contains(github.event.pull_request.head.ref, 'APMSPII-') || contains(github.event.pull_request.head.ref, 'adz-') || contains(github.event.pull_request.head.ref, 'ADZ-') || contains(github.event.pull_request.head.ref, 'DMS-')
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To test this locally you will need a local environment set up, please contact a
Successful deployment of consumer apps in production requires a custom attribute key-value pair with name `authorised_targets` and a value set to a comma-delimited list of target immunisations, e.g.

```yaml
authorised_targets: COVID19,HPV
authorised_targets: COVID19,HPV,FLU
```
or for a single immunisation target, e.g.:
Expand Down
3 changes: 2 additions & 1 deletion sandbox/immunization-handler/v1/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const moment = require('moment');

const IMMUNIZATION_TARGETS = {
HPV: 'HPV',
COVID19: 'COVID19'
COVID19: 'COVID19',
FLU: 'FLU'
};

const SNOMED_PROCEDURE_CODES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
const { isEntryWithinDateRange } = require('./response-helper');
const { patientFhir } = require('./patient.fhir');

const entries = [
{
fullUrl: 'urn:uuid:f1f61af6-4a6f-4487-8579-70ce5c6abce4',
resource: {
resourceType: 'Immunization',
extension: [
{
url: 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure',
valueCodeableConcept: {
coding: [
{
system: 'http://snomed.info/sct',
code: '884861000000100',
display:
'null'
}
]
}
}
],
identifier: [
{
use: 'secondary',
system: 'https://supplierABC/identifiers/vacc',
value: '1324761000000100'
}
],
status: 'completed',
vaccineCode: {
coding: [
{
system: 'http://snomed.info/sct',
code: '22704311000001108',
display:
'Fluarix Tetra vaccine suspension for injection 0.5ml pre-filled syringes (GlaxoSmithKline UK Ltd) (product)'
}
]
},
patient: {
reference: 'urn:uuid:124fcb63-669c-4a3c-af2b-caf55de167ec',
type: 'Patient',
identifier: {
system: 'https://fhir.nhs.uk/Id/nhs-number',
value: '9000000009'
}
},
occurrenceDateTime: '2021-08-02T12:46:16.019+00:00',
recorded: '2021-02-14',
primarySource: true,
manufacturer: {
display: 'GlaxoSmithKline UK Ltd'
},
lotNumber: 'XDKOPHGTENHOIOVCTBFI',
expirationDate: '2021-04-29',
site: {
coding: [
{
system: 'http://snomed.info/sct',
code: '368209003',
display: 'Right upper arm structure (body structure)'
}
]
},
route: {
coding: [
{
system: 'http://snomed.info/sct',
code: '2164884015',
display: 'Intracutaneous use'
}
]
},
doseQuantity: {
system: 'http://snomed.info/sct',
value: 1,
unit: 'Ampoule',
code: '2535128013'
},
reportOrigin: {},
performer: [
{
actor: {
type: 'Organization',
identifier: {
system: 'https://fhir.nhs.uk/Id/ods-organization-code',
value: 'RX809'
},
display: 'TEST-SITE'
}
}
],
reasonCode: [
{
coding: [
{
system: 'http://snomed.info/sct',
code: '443684005',
display: 'Disease outbreak (event)'
}
]
}
],
protocolApplied: [
{
doseNumberPositiveInt: 1
}
]
},
search: {
mode: 'match'
}
},
];

exports.fluImmunizationFhir = (dateFrom, dateTo) => {
const filteredEntries = entries.filter(entry => isEntryWithinDateRange(entry, dateFrom, dateTo));
const vaccineLength = filteredEntries.length;
filteredEntries.push(patientFhir());
return {
resourceType: 'Bundle',
type: 'searchset',
total: vaccineLength,
entry: filteredEntries
};
};
5 changes: 5 additions & 0 deletions sandbox/immunization-handler/v1/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { emptyImmunizationFhir } = require('./fhir-responses/empty-immunization.f
const { SNOMED_PROCEDURE_CODES, IMMUNIZATION_TARGETS } = require('./constants');
const { covidImmunizationFhir } = require('./fhir-responses/covid-immunization.fhir');
const { hpvImmunizationFhir } = require('./fhir-responses/hpv-immunization.fhir');
const { fluImmunizationFhir } = require('./fhir-responses/flu-immunization.fhir');
const { badRequest } = require('../api-response');
const { parseDateRange, validateDateRange } = require('./date-range');
const { writeLog } = require('../../logging');
Expand Down Expand Up @@ -30,6 +31,10 @@ function getImmunizationResponse(
if (immunizationTarget === IMMUNIZATION_TARGETS.HPV) {
return hpvImmunizationFhir(dateFrom, dateTo);
}

if (immunizationTarget === IMMUNIZATION_TARGETS.FLU) {
return fluImmunizationFhir(dateFrom, dateTo);
}
}

function getFhirResponse(
Expand Down
3 changes: 2 additions & 1 deletion sandbox/immunization-handler/v2/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const moment = require('moment');

const IMMUNIZATION_TARGETS = {
HPV: 'HPV',
COVID19: 'COVID19'
COVID19: 'COVID19',
FLU: 'FLU'
};

const SNOMED_PROCEDURE_CODES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
const { isEntryWithinDateRange } = require('./response-helper');
const { patientFhir } = require('./patient.fhir');

const entries = [
{
fullUrl: 'urn:uuid:f1f61af6-4a6f-4487-8579-70ce5c6abce4',
resource: {
resourceType: 'Immunization',
extension: [
{
url: 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure',
valueCodeableConcept: {
coding: [
{
system: 'http://snomed.info/sct',
code: '884861000000100',
display:
'null'
}
]
}
}
],
identifier: [
{
use: 'secondary',
system: 'https://supplierABC/identifiers/vacc',
value: '1324761000000100'
}
],
status: 'completed',
vaccineCode: {
coding: [
{
system: 'http://snomed.info/sct',
code: '22704311000001108',
display:
'Fluarix Tetra vaccine suspension for injection 0.5ml pre-filled syringes (GlaxoSmithKline UK Ltd) (product)'
}
]
},
patient: {
reference: 'urn:uuid:124fcb63-669c-4a3c-af2b-caf55de167ec',
type: 'Patient',
identifier: {
system: 'https://fhir.nhs.uk/Id/nhs-number',
value: '9000000009'
}
},
occurrenceDateTime: '2021-08-02T12:46:16.019+00:00',
recorded: '2021-02-14',
primarySource: true,
manufacturer: {
display: 'GlaxoSmithKline UK Ltd'
},
lotNumber: 'XDKOPHGTENHOIOVCTBFI',
expirationDate: '2021-04-29',
site: {
coding: [
{
system: 'http://snomed.info/sct',
code: '368209003',
display: 'Right upper arm structure (body structure)'
}
]
},
route: {
coding: [
{
system: 'http://snomed.info/sct',
code: '2164884015',
display: 'Intracutaneous use'
}
]
},
doseQuantity: {
system: 'http://snomed.info/sct',
value: 1,
unit: 'Ampoule',
code: '2535128013'
},
reportOrigin: {},
performer: [
{
actor: {
type: 'Organization',
identifier: {
system: 'https://fhir.nhs.uk/Id/ods-organization-code',
value: 'RX809'
},
display: 'TEST-SITE'
}
}
],
reasonCode: [
{
coding: [
{
system: 'http://snomed.info/sct',
code: '443684005',
display: 'Disease outbreak (event)'
}
]
}
],
protocolApplied: [
{
doseNumberPositiveInt: 1
}
]
},
search: {
mode: 'match'
}
},
];

exports.fluImmunizationFhir = (dateFrom, dateTo) => {
const filteredEntries = entries.filter(entry => isEntryWithinDateRange(entry, dateFrom, dateTo));
const vaccineLength = filteredEntries.length;
filteredEntries.push(patientFhir());
return {
resourceType: 'Bundle',
type: 'searchset',
total: vaccineLength,
entry: filteredEntries
};
};
6 changes: 6 additions & 0 deletions sandbox/immunization-handler/v2/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { emptyImmunizationFhir } = require('./fhir-responses/empty-immunization.f
const { SNOMED_PROCEDURE_CODES, IMMUNIZATION_TARGETS } = require('./constants');
const { covidImmunizationFhir } = require('./fhir-responses/covid-immunization.fhir');
const { hpvImmunizationFhir } = require('./fhir-responses/hpv-immunization.fhir');
const { fluImmunizationFhir } = require('./fhir-responses/flu-immunization.fhir')
const { parseDateRange, validateDateRange } = require('./date-range');
const { writeLog } = require('../../logging');
const { HTTP_STATUS, API_VERSIONS } = require('../constants');
Expand Down Expand Up @@ -30,6 +31,11 @@ function getImmunizationResponse(
if (immunizationTarget === IMMUNIZATION_TARGETS.HPV) {
return hpvImmunizationFhir(dateFrom, dateTo);
}

if (fluImmunizationFhir === IMMUNIZATION_TARGETS.FLU) {
return fluImmunizationFhir(dateFrom, dateTo);
}

}

function getFhirResponse(
Expand Down
1 change: 1 addition & 0 deletions specification/immunisation-history.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ paths:
enum:
- COVID19
- HPV
- FLU
- name: date.from
in: query
description: |
Expand Down

0 comments on commit 4fedbc2

Please sign in to comment.