From 9eb8be36af15a07baf323f7a04a96bea89b84341 Mon Sep 17 00:00:00 2001 From: Ryan Crichton Date: Thu, 14 Mar 2024 09:39:49 +0200 Subject: [PATCH 01/13] Add functionality to save by source ID and swap source ID for interaction ID in FHIR Patient endpoint --- src/routes/index.ts | 74 ++++++++++++++++++++++++++++++++++++++++++++- src/utils/utils.ts | 3 +- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index 91bc49b..62bafd7 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -8,11 +8,14 @@ import { matchAsyncHandler } from './handlers/matchPatientAsync'; import { matchSyncHandler } from './handlers/matchPatientSync'; import { mpiMdmQueryLinksMiddleware } from '../middlewares/mpi-mdm-query-links'; import { validationMiddleware } from '../middlewares/validation'; -import { buildOpenhimResponseObject } from '../utils/utils'; +import { buildOpenhimResponseObject, getData } from '../utils/utils'; import { fetchEverythingByRef } from './handlers/fetchPatientResources'; import { mpiMdmSummaryMiddleware } from '../middlewares/mpi-mdm-summary'; import { fetchPatientSummaryByRef } from './handlers/fetchPatientSummaries'; import { getConfig } from '../config/config'; +import { Patient } from 'fhir/r3'; +import { getMpiAuthToken } from '../utils/mpi'; +import logger from '../logger'; const routes = express.Router(); @@ -61,6 +64,75 @@ routes.post( mpiAccessProxyMiddleware ); +// swap source ID for interaction ID +routes.get('/fhir/Patient/:patientId', async (req, res) => { + const requestedId = req.params.patientId; + + logger.debug(`Fetching patient ${requestedId} from FHIR store`); + + const { + fhirDatastoreProtocol: fhirProtocol, + fhirDatastoreHost: fhirHost, + fhirDatastorePort: fhirPort, + mpiProtocol: mpiProtocol, + mpiHost: mpiHost, + mpiPort: mpiPort, + mpiAuthEnabled, + } = getConfig(); + const fhirResponse = await getData( + fhirProtocol, + fhirHost, + fhirPort, + `/fhir/Patient/${requestedId}`, + {} + ); + + let upsteamId = requestedId; + + if (fhirResponse.status === 200) { + const patient = fhirResponse.body as Patient; + const interactionId = + patient.link && patient.link[0]?.other.reference?.match(/Patient\/([^/]+)/)?.[1]; + + if (interactionId) { + upsteamId = interactionId; + logger.debug(`Swapping source ID ${requestedId} for interaction ID ${upsteamId}`); + } + } + + logger.debug(`Fetching patient ${upsteamId} from MPI`); + + const headers: HeadersInit = { + 'Content-Type': 'application/fhir+json', + }; + + if (mpiAuthEnabled) { + const token = await getMpiAuthToken(); + + headers['Authorization'] = `Bearer ${token.accessToken}`; + } + + const mpiResponse = await getData( + mpiProtocol, + mpiHost, + mpiPort, + `/fhir/links/Patient/${upsteamId}`, + {} + ); + + // Map the upstreamId to the requestedId + if (mpiResponse.status === 200) { + const patient = mpiResponse.body as Patient; + + patient.id = requestedId; + logger.debug( + `Mapped upstream ID ${upsteamId} to requested ID ${requestedId} in response body` + ); + } + + res.status(mpiResponse.status).send(mpiResponse.body); +}); + routes.get( '/fhir/Patient/:patientId/\\$everything', mpiMdmEverythingMiddleware, diff --git a/src/utils/utils.ts b/src/utils/utils.ts index bab600d..efa81e8 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -163,6 +163,7 @@ export const modifyBundle = ( fullUrl: entry.fullUrl, resource: { resourceType: 'Patient', + id: entry.resource.id, link: [ { other: { @@ -174,7 +175,7 @@ export const modifyBundle = ( }, request: { method: 'PUT', - url: `Patient/${newPatientId}`, + url: `Patient/${entry.resource.id}`, }, }; From 0df38cc0fcd9be313c75ea6625f2a1d45574463e Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 29 Apr 2024 12:52:33 +0200 Subject: [PATCH 02/13] Modify the method for fetching all related patients The gutted patient is now stored with the source id instead of the client registry interaction id. The gutted patient contains the link to the patient in the client registry. We now fetch the patient from hapi fhir and then use the interaction id in the link to fetch all the patient's links from the client registry --- src/utils/mpi.ts | 69 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/src/utils/mpi.ts b/src/utils/mpi.ts index a5d7f95..02a5613 100644 --- a/src/utils/mpi.ts +++ b/src/utils/mpi.ts @@ -1,6 +1,6 @@ import { Patient, Resource } from 'fhir/r3'; import { getConfig } from '../config/config'; -import { getData, isHttpStatusOk } from './utils'; +import { createNewPatientRef, getData, isHttpStatusOk } from './utils'; import { ClientOAuth2, OAuth2Token } from './client-oauth2'; // Singleton instance of MPI Token stored in memory @@ -60,24 +60,59 @@ export const fetchMpiResourceByRef = async ( return isHttpStatusOk(response.status) ? (response.body as T) : undefined; }; -/** - * Recursively fetch linked patient refs from the MPI - */ export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: string[]) => { - patientLinks.push(patientRef); - - const patient = await fetchMpiResourceByRef(patientRef); - - if (patient?.link) { - const linkedRefs = patient.link.map(({ other }) => other.reference); - const refsToFetch = linkedRefs.filter((ref) => { - return ref && !patientLinks.includes(ref); - }) as string[]; + const { + mpiProtocol: protocol, + mpiHost: host, + mpiPort: port, + mpiAuthEnabled, + fhirDatastoreHost, + fhirDatastorePort, + fhirDatastoreProtocol, + } = getConfig(); + const headers: HeadersInit = { + 'Content-Type': 'application/fhir+json', + }; - if (refsToFetch.length > 0) { - const promises = refsToFetch.map((ref) => fetchMpiPatientLinks(ref, patientLinks)); + if (mpiAuthEnabled) { + const token = await getMpiAuthToken(); - await Promise.all(promises); - } + headers['Authorization'] = `Bearer ${token.accessToken}`; } + + const guttedPatient = await getData( + fhirDatastoreProtocol, + fhirDatastoreHost, + fhirDatastorePort, + `/fhir/${patientRef}`, + headers + ); + + // Fetch patient links from MPI + const mpiPatient = await getData( + protocol, + host, + port, + `/fhir/links/Patient/${Object.assign(guttedPatient.body) + .link[0].other.reference.split('/') + .pop()}`, + headers + ); + + const links: string[] = Object.assign(mpiPatient.body).link.map( + (element: { other: { reference: string } }) => + createNewPatientRef(element.other.reference.split('/').pop() || '') + ); + + const guttedPatients = await getData( + fhirDatastoreProtocol, + fhirDatastoreHost, + fhirDatastorePort, + `/fhir/Patient?link=${encodeURIComponent(links.join(','))}`, + headers + ); + + Object.assign(guttedPatients.body).entry.forEach((patient: { fullUrl: string }) => { + patientLinks.push(patient.fullUrl); + }); }; From 95b7de15cd481c112836317dfd09a9e510b086a7 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 29 Apr 2024 12:58:42 +0200 Subject: [PATCH 03/13] Fix the breaking tests after adjusting the method for fetching patient links --- tests/unit/matchPatientSync.ts | 3 ++- tests/unit/middlewares.ts | 21 ++++++++++++++++----- tests/unit/mpi.ts | 15 ++++++++++++--- tests/unit/utils.ts | 6 ++++-- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/tests/unit/matchPatientSync.ts b/tests/unit/matchPatientSync.ts index 8a653fb..1105f4a 100644 --- a/tests/unit/matchPatientSync.ts +++ b/tests/unit/matchPatientSync.ts @@ -343,9 +343,10 @@ describe('Match Patient Synchronously', (): void => { fullUrl: 'Patient/12333', request: { method: 'PUT', - url: 'Patient/testPatient', + url: 'Patient/12333', }, resource: { + id: '12333', link: [ { other: { diff --git a/tests/unit/middlewares.ts b/tests/unit/middlewares.ts index c2fabc3..b5e6908 100644 --- a/tests/unit/middlewares.ts +++ b/tests/unit/middlewares.ts @@ -9,6 +9,7 @@ import { mpiMdmQueryLinksMiddleware } from '../../src/middlewares/mpi-mdm-query- import { validationMiddleware } from '../../src/middlewares/validation'; import { mpiAuthMiddleware } from '../../src/middlewares/mpi-auth'; import { mpiMdmSummaryMiddleware } from '../../src/middlewares/mpi-mdm-summary'; +import { createNewPatientRef } from '../../src/utils/utils'; const config = getConfig(); @@ -31,7 +32,7 @@ const patientFhirResource1: Patient = { link: [ { other: { - reference: 'Patient/2', + reference: 'Patient/0x4', }, type: 'refer', }, @@ -44,7 +45,7 @@ const patientFhirResource2: Patient = { link: [ { other: { - reference: 'Patient/1', + reference: 'Patient/0x7', }, type: 'seealso', }, @@ -324,8 +325,11 @@ describe('Middlewares', (): void => { it('should perform MDM expansion when mdm param is supplied', async () => { nock(mpiUrl).persist().post('/auth/oauth2_token').reply(200, newOauth2TokenGenerated); - nock(mpiUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + nock(mpiUrl).get('/fhir/links/Patient/0x4').reply(200, {...patientFhirResource1, link: [{other: {reference: 'Patient/0x4'}}, {other: {reference: 'Patient/0x7'}}]}); nock(mpiUrl).get('/fhir/Patient/2').reply(200, patientFhirResource2); + const links = encodeURIComponent([createNewPatientRef('0x4'),createNewPatientRef('0x7')].join(',')) + nock(fhirDatastoreUrl).get(`/fhir/Patient?link=${links}`).reply(200, {entry: [{fullUrl: 'Patient/1'}, {fullUrl: 'Patient/2'}]}); + nock(fhirDatastoreUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); nock(fhirDatastoreUrl) .get(`/fhir/Encounter?subject=${encodeURIComponent('Patient/1,Patient/2')}`) .reply(200, Encounters); @@ -383,8 +387,11 @@ describe('Middlewares', (): void => { it('should preform MDM expansion when mdm param is supplied', async () => { nock(mpiUrl).persist().post('/auth/oauth2_token').reply(200, newOauth2TokenGenerated); - nock(mpiUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + nock(mpiUrl).get('/fhir/links/Patient/0x4').reply(200, {...patientFhirResource1, link: [{other: {reference: 'Patient/0x4'}}, {other: {reference: 'Patient/0x7'}}]}); nock(mpiUrl).get('/fhir/Patient/2').reply(200, patientFhirResource2); + const links = encodeURIComponent([createNewPatientRef('0x4'),createNewPatientRef('0x7')].join(',')) + nock(fhirDatastoreUrl).get(`/fhir/Patient?link=${links}`).reply(200, {entry: [{fullUrl: 'Patient/1'}, {fullUrl: 'Patient/2'}]}); + nock(fhirDatastoreUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); nock(fhirDatastoreUrl) .get(`/fhir/${patientRefSummary1}/$summary`) .reply(200, patientSummary1); @@ -435,8 +442,12 @@ describe('Middlewares', (): void => { it('should perform MDM expansion when mdm param is supplied', async () => { nock(mpiUrl).persist().post('/auth/oauth2_token').reply(200, {}); - nock(mpiUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + nock(mpiUrl).get('/fhir/links/Patient/0x4').reply(200, {...patientFhirResource1, link: [{other: {reference: 'Patient/0x4'}}, {other: {reference: 'Patient/0x7'}}]}); nock(mpiUrl).get('/fhir/Patient/2').reply(200, patientFhirResource2); + const links = encodeURIComponent([createNewPatientRef('0x4'),createNewPatientRef('0x7')].join(',')) + nock(fhirDatastoreUrl).get(`/fhir/Patient?link=${links}`).reply(200, {entry: [{fullUrl: 'Patient/1'}, {fullUrl: 'Patient/2'}]}); + nock(fhirDatastoreUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + const request = { body: {}, headers: {}, diff --git a/tests/unit/mpi.ts b/tests/unit/mpi.ts index 3325fea..9355156 100644 --- a/tests/unit/mpi.ts +++ b/tests/unit/mpi.ts @@ -9,6 +9,7 @@ import { fetchMpiResourceByRef, fetchMpiPatientLinks, } from '../../src/utils/mpi'; +import { createNewPatientRef } from '../../src/utils/utils'; const config = getConfig(); @@ -16,6 +17,9 @@ const { mpiProtocol, mpiHost, mpiPort, mpiClientId, mpiClientSecret } = config; const mpiUrl = `${mpiProtocol}://${mpiHost}:${mpiPort}`; +const { fhirDatastoreProtocol, fhirDatastoreHost, fhirDatastorePort } = config; +const fhirDatastoreUrl = `${fhirDatastoreProtocol}://${fhirDatastoreHost}:${fhirDatastorePort}`; + const newOauth2TokenGenerated = { token_type: 'bearer', access_token: 'accessToken', @@ -51,7 +55,7 @@ const patientFhirResource1: Patient = { link: [ { other: { - reference: 'Patient/2', + reference: 'Patient/0x4', }, type: 'refer', }, @@ -64,7 +68,7 @@ const patientFhirResource2: Patient = { link: [ { other: { - reference: 'Patient/1', + reference: 'Patient/0x7', }, type: 'seealso', }, @@ -140,8 +144,13 @@ describe('MPI', (): void => { describe('*fetchMpiPatientLinks', async (): Promise => { it('should fetch patient links from MPI fhir', async (): Promise => { - nock(mpiUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + nock(mpiUrl).persist().post('/auth/oauth2_token').reply(200, newOauth2TokenGenerated); + nock(mpiUrl).get('/fhir/links/Patient/0x4').reply(200, {...patientFhirResource1, link: [{other: {reference: 'Patient/0x4'}}, {other: {reference: 'Patient/0x7'}}]}); nock(mpiUrl).get('/fhir/Patient/2').reply(200, patientFhirResource2); + const links = encodeURIComponent([createNewPatientRef('0x4'),createNewPatientRef('0x7')].join(',')) + nock(fhirDatastoreUrl).get(`/fhir/Patient?link=${links}`).reply(200, {entry: [{fullUrl: 'Patient/1'}, {fullUrl: 'Patient/2'}]}); + nock(fhirDatastoreUrl).get('/fhir/Patient/1').reply(200, patientFhirResource1); + const refs: string[] = []; await fetchMpiPatientLinks(`Patient/1`, refs); expect(refs).to.deep.equal(['Patient/1', 'Patient/2']); diff --git a/tests/unit/utils.ts b/tests/unit/utils.ts index 3601838..c8666e9 100644 --- a/tests/unit/utils.ts +++ b/tests/unit/utils.ts @@ -359,6 +359,7 @@ describe('Utils', (): void => { fullUrl: 'Patient/1234', resource: { resourceType: 'Patient', + id: '1233', link: [ { type: 'refer', @@ -370,7 +371,7 @@ describe('Utils', (): void => { }, request: { method: 'PUT', - url: 'Patient/xxx', + url: 'Patient/1233', }, }, ], @@ -473,6 +474,7 @@ describe('Utils', (): void => { profile: ['http://example.com/patient-profile'], }, resourceType: 'Patient', + id: '1233', link: [ { type: 'refer', @@ -484,7 +486,7 @@ describe('Utils', (): void => { }, request: { method: 'PUT', - url: 'Patient/xxx', + url: 'Patient/1233', }, }, ], From a7fc70e327fa3a45d36bc75790ad21ada7402972 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 29 Apr 2024 13:32:47 +0200 Subject: [PATCH 04/13] Cater for sante mpi which uses the '/fhir/Patient/xxx' endpoint for fetching endpoint --- src/utils/mpi.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/utils/mpi.ts b/src/utils/mpi.ts index 02a5613..588e213 100644 --- a/src/utils/mpi.ts +++ b/src/utils/mpi.ts @@ -89,7 +89,7 @@ export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: str ); // Fetch patient links from MPI - const mpiPatient = await getData( + let mpiPatient = await getData( protocol, host, port, @@ -99,6 +99,18 @@ export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: str headers ); + if (!isHttpStatusOk(mpiPatient.status)) { + await getData( + protocol, + host, + port, + `/fhir/Patient/${Object.assign(guttedPatient.body) + .link[0].other.reference.split('/') + .pop()}`, + headers + ); + } + const links: string[] = Object.assign(mpiPatient.body).link.map( (element: { other: { reference: string } }) => createNewPatientRef(element.other.reference.split('/').pop() || '') From dc3119a02190c4efa63909c3ec0c7d29d6991138 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 29 Apr 2024 17:50:43 +0200 Subject: [PATCH 05/13] Refactor method to use set to avoid duplication --- src/utils/mpi.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/utils/mpi.ts b/src/utils/mpi.ts index 588e213..8049156 100644 --- a/src/utils/mpi.ts +++ b/src/utils/mpi.ts @@ -61,6 +61,9 @@ export const fetchMpiResourceByRef = async ( }; export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: string[]) => { + const patientLinksSet: Set = new Set(); + patientLinksSet.add(patientRef); + const { mpiProtocol: protocol, mpiHost: host, @@ -99,8 +102,9 @@ export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: str headers ); + // Cater for SanteMpi client registry if (!isHttpStatusOk(mpiPatient.status)) { - await getData( + mpiPatient = await getData( protocol, host, port, @@ -124,7 +128,8 @@ export const fetchMpiPatientLinks = async (patientRef: string, patientLinks: str headers ); - Object.assign(guttedPatients.body).entry.forEach((patient: { fullUrl: string }) => { - patientLinks.push(patient.fullUrl); + Object.assign(guttedPatients.body).entry?.forEach((patient: { fullUrl: string }) => { + patientLinksSet.add(patient.fullUrl); }); + patientLinks.push(...patientLinksSet); }; From 86c6b2c9bda54c28c303e8316077afa1b63ac91e Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 29 Apr 2024 17:51:19 +0200 Subject: [PATCH 06/13] Fix breaking tests --- tests/cucumber/step-definitions/fhirAccessProxy.ts | 4 ++-- .../step-definitions/patientSyncMatching.ts | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/cucumber/step-definitions/fhirAccessProxy.ts b/tests/cucumber/step-definitions/fhirAccessProxy.ts index 171cc55..7a6b79c 100644 --- a/tests/cucumber/step-definitions/fhirAccessProxy.ts +++ b/tests/cucumber/step-definitions/fhirAccessProxy.ts @@ -31,7 +31,7 @@ Given('MPI and FHIR services are up and running', async (): Promise => { When('an $everything search request is sent', async (): Promise => { const response = await request - .get('/fhir/Patient/1/$everything?_mdm=true') + .get('/fhir/Patient/testPatient/$everything?_mdm=true') .set('Content-Type', 'application/fhir+json') .expect(200); responseBody = response.body; @@ -77,7 +77,7 @@ Then('a successful response containing a bundle is sent back', (): void => { When('an MDM search request is sent', async (): Promise => { const response = await request - .get('/fhir/Observation?subject:mdm=Patient/1') + .get('/fhir/Observation?subject:mdm=Patient/testPatient') .set('Content-Type', 'application/fhir+json') .expect(200); diff --git a/tests/cucumber/step-definitions/patientSyncMatching.ts b/tests/cucumber/step-definitions/patientSyncMatching.ts index b9a23ef..747c568 100644 --- a/tests/cucumber/step-definitions/patientSyncMatching.ts +++ b/tests/cucumber/step-definitions/patientSyncMatching.ts @@ -103,8 +103,20 @@ Then('a patient should be created on the client registry', async (): Promise Date: Tue, 30 Apr 2024 05:33:41 +0200 Subject: [PATCH 07/13] Add data before sending the $everything request --- tests/cucumber/features/fhirAccessProxy.feature | 3 ++- tests/cucumber/step-definitions/fhirAccessProxy.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/cucumber/features/fhirAccessProxy.feature b/tests/cucumber/features/fhirAccessProxy.feature index 085b509..e0c2001 100644 --- a/tests/cucumber/features/fhirAccessProxy.feature +++ b/tests/cucumber/features/fhirAccessProxy.feature @@ -3,7 +3,8 @@ Feature: FHIR Access Proxy Scenario: Valid $everything Request Given MPI and FHIR services are up and running - When an $everything search request is sent + When there is data + And an $everything search request is sent Then a successful response containing a bundle of related patient resources is sent back Scenario: Valid $everything Request without MDM diff --git a/tests/cucumber/step-definitions/fhirAccessProxy.ts b/tests/cucumber/step-definitions/fhirAccessProxy.ts index 7a6b79c..37e51b9 100644 --- a/tests/cucumber/step-definitions/fhirAccessProxy.ts +++ b/tests/cucumber/step-definitions/fhirAccessProxy.ts @@ -29,6 +29,16 @@ Given('MPI and FHIR services are up and running', async (): Promise => { request = supertest(server); }); +When('there is data', async (): Promise => { + const response = await request + .post('/fhir') + .send(bundle) + .set('content-type', 'application/fhir+json') + .expect(200); + + responseBody = response.body; +}); + When('an $everything search request is sent', async (): Promise => { const response = await request .get('/fhir/Patient/testPatient/$everything?_mdm=true') From 3a806bfdb8b187fcb70291c34b1c51b37ebb5e80 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:35:53 +0200 Subject: [PATCH 08/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index 62bafd7..c28ea46 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -87,7 +87,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { {} ); - let upsteamId = requestedId; + let upstreamId = requestedId; if (fhirResponse.status === 200) { const patient = fhirResponse.body as Patient; From ac7c5247646ee416b74c31b7eb005898a4e53ad8 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:36:04 +0200 Subject: [PATCH 09/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index c28ea46..b194611 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -95,7 +95,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { patient.link && patient.link[0]?.other.reference?.match(/Patient\/([^/]+)/)?.[1]; if (interactionId) { - upsteamId = interactionId; + upstreamId = interactionId; logger.debug(`Swapping source ID ${requestedId} for interaction ID ${upsteamId}`); } } From 358fd0a5f3459c6a4d04b3e921c3a760e9f69d9b Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:36:16 +0200 Subject: [PATCH 10/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index b194611..c65ac0a 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -96,7 +96,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { if (interactionId) { upstreamId = interactionId; - logger.debug(`Swapping source ID ${requestedId} for interaction ID ${upsteamId}`); + logger.debug(`Swapping source ID ${requestedId} for interaction ID ${upstreamId}`); } } From dd77dc321dc055380f813003c02ca6043df2f94c Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:36:35 +0200 Subject: [PATCH 11/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index c65ac0a..d1f2a2f 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -100,7 +100,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { } } - logger.debug(`Fetching patient ${upsteamId} from MPI`); + logger.debug(`Fetching patient ${upstreamId} from MPI`); const headers: HeadersInit = { 'Content-Type': 'application/fhir+json', From 874abbb98a8c0529a3842d6293bdd34ee2b3318e Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:36:47 +0200 Subject: [PATCH 12/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index d1f2a2f..a40b6ea 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -116,7 +116,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { mpiProtocol, mpiHost, mpiPort, - `/fhir/links/Patient/${upsteamId}`, + `/fhir/links/Patient/${upstreamId}`, {} ); From 7eea2fbdb419725ceaed80edbe7bc40693c9b431 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 2 May 2024 12:37:01 +0200 Subject: [PATCH 13/13] Fix typo Co-authored-by: MatthewErispe --- src/routes/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/index.ts b/src/routes/index.ts index a40b6ea..dc1a5a9 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -126,7 +126,7 @@ routes.get('/fhir/Patient/:patientId', async (req, res) => { patient.id = requestedId; logger.debug( - `Mapped upstream ID ${upsteamId} to requested ID ${requestedId} in response body` + `Mapped upstream ID ${upstreamId} to requested ID ${requestedId} in response body` ); }