From 80538e7f7a2cfeea9d18fe31fc11ee7c24f13873 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Wed, 17 Jul 2024 13:18:49 -0700 Subject: [PATCH 01/29] AD: show date of PDF creation; hide DocumentReference.date; tinker with version number per IG changes since last cthon. --- src/lib/resource-templates/AdvanceDirective.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index a8c1efde..86970168 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -46,14 +46,18 @@ Text:
Version number: {#if resource.extension && resource.extension[0] && resource.extension[0].url && resource.extension[0].url == 'http://hl7.org/fhir/us/ccda/StructureDefinition/VersionNumber'} - {resource.extension[0].valueInteger} + + As an integer (prior IG): {resource.extension[0].valueInteger} {/if}
+ Status: {#if resource.status} {resource.status} @@ -73,6 +77,9 @@ Text: {#if content.attachment && content.attachment.contentType === "application/pdf" && content.attachment.data} {#await base64toBlob(content.attachment.data, content.attachment.contentType) then url} PDF present: View + {#if content.attachment && content.attachment.creation} + Date of PDF creation: {new Date(content.attachment.creation).toISOString().slice(0,10)}. + {/if} {/await} {/if} {/each} From 805ab05749a1f531f2bc904fe9a9fb7c105b74dc Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Wed, 17 Jul 2024 15:29:33 -0700 Subject: [PATCH 02/29] Update the "nonSignatureDR" filter to accomodate changes in reference implementation. Adds TODO: get signature dates. --- src/lib/FetchAD.svelte | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index cad8a8be..cc5e6b03 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -300,10 +300,25 @@ console.warn("No advance directives found for patient "+patient.id); } - // If resource.category doesn't exist, ignore the DR - DR's w/out that are simply signature DR's. - // Lambda function to check if resource.category exists - const nonSignatureDR = dr => dr.category !== undefined; - // Filter out resources that don't have a category + // Filter out DR's with 'status' == 'superseded'. In May '24 we included these, + // but they are just noise since IPS doesn't want to address the complexity of + // showing these in the UI behind something like a "history" element. + // Lambda function to check this: + const nonSupersededDR = dr => dr.status !== 'superseded'; + // Filter out signature resources + resources = resources.filter(nonSupersededDR); + + // TODO iterate over DR's that are for signatures. + // Get the date from when it was signed, and show that in the card for the DocumentReference + // that it applies to. + // That date will be in content.attachment.creation (Lisa to add the evening of 2024-07-17). + + // July '24: unlike the May '24 connectathon, signature DR's now have resource.category defined. + // The ADI team is planning to add a code for these later, but for the time being they suggest + // that we identify these by: "description": "JWS of the FHIR Document", + // FIXME may be better to do this when we iterate for the TODO above. + const nonSignatureDR = dr => dr.description !== 'JWS of the FHIR Document'; + // Filter out signature resources resources = resources.filter(nonSignatureDR); // if one of the DR's `content` elements has attachment.contentType = 'application/pdf', download if possible, put base64 of pdf in DR.content.attachment.data From 48d7aa336fbc4f4ad317849254d51c9000e69bac Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Wed, 17 Jul 2024 15:38:28 -0700 Subject: [PATCH 03/29] Revert tinker of version numbrer handling, no change needed. --- src/lib/resource-templates/AdvanceDirective.svelte | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 86970168..2612b168 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -46,9 +46,8 @@ Text:
Version number: {#if resource.extension && resource.extension[0] && resource.extension[0].url && resource.extension[0].url == 'http://hl7.org/fhir/us/ccda/StructureDefinition/VersionNumber'} - - As an integer (prior IG): {resource.extension[0].valueInteger} + + {resource.extension[0].valueInteger} {/if}
+ Date PDF was signed: {resource.pdfSignedDate}. + {/if} {/await} {/if} {/each} From bdfb7d86db12de0e67ba7abdfde23a6c0a01daf7 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Wed, 17 Jul 2024 22:22:08 -0700 Subject: [PATCH 05/29] add a clarifying comment --- src/lib/FetchAD.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index fc2fdcac..b225aa07 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -323,7 +323,7 @@ pdfSignDate = dr.content.attachment; } let resourceSigned = resources.find((item) => item.id == target); - resourceSigned.pdfSignedDate = pdfSignDate; + resourceSigned.pdfSignedDate = pdfSignDate; // pdfSignedDate is an ad-hoc property name } }); From c976147f78a5bbfc652ae3f1c074b3ec300691d6 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Thu, 18 Jul 2024 07:50:38 -0700 Subject: [PATCH 06/29] Fix reading of new date --- src/lib/FetchAD.svelte | 4 ++-- src/lib/resource-templates/AdvanceDirective.svelte | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index b225aa07..d24eb94a 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -319,8 +319,8 @@ let target = dr.relatesTo[0].target.reference; target = target.substring(18); let pdfSignDate = '(missing from content.attachment.creation in signature DocumentReference)'; // placeholder until Lisa's change - if (dr.content && dr.content.attachment && dr.content.attachment){ - pdfSignDate = dr.content.attachment; + if (dr.content && dr.content[0] && dr.content[0].attachment && dr.content[0].attachment.creation){ + pdfSignDate = dr.content[0].attachment.creation; } let resourceSigned = resources.find((item) => item.id == target); resourceSigned.pdfSignedDate = pdfSignDate; // pdfSignedDate is an ad-hoc property name diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 39c29afb..d5179a9d 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -77,11 +77,11 @@ Text: {#await base64toBlob(content.attachment.data, content.attachment.contentType) then url} PDF present: View {#if content.attachment && content.attachment.creation} - Date of PDF creation: {new Date(content.attachment.creation).toISOString().slice(0,10)}. + Date PDF created: {new Date(content.attachment.creation).toISOString().slice(0,10)}. {/if} {#if resource.pdfSignedDate} - Date PDF was signed: {resource.pdfSignedDate}. + Date PDF signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)}. {/if} {/await} {/if} From 03a30d982aa74b0b29aad50d38b667dec28a86eb Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Thu, 18 Jul 2024 07:51:59 -0700 Subject: [PATCH 07/29] Re-order PDF info section --- src/lib/resource-templates/AdvanceDirective.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index d5179a9d..67b22aa9 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -75,7 +75,7 @@ Text: {#each resource.content as content} {#if content.attachment && content.attachment.contentType === "application/pdf" && content.attachment.data} {#await base64toBlob(content.attachment.data, content.attachment.contentType) then url} - PDF present: View + PDF present: {#if content.attachment && content.attachment.creation} Date PDF created: {new Date(content.attachment.creation).toISOString().slice(0,10)}. {/if} @@ -83,6 +83,7 @@ Text: Date PDF signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)}. {/if} + View {/await} {/if} {/each} From d167b0e69abcf6e3d050cafcdd5b6799f31524f4 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Thu, 18 Jul 2024 08:04:32 -0700 Subject: [PATCH 08/29] Refine pdf section again --- src/lib/resource-templates/AdvanceDirective.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 67b22aa9..b0799f6b 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -77,11 +77,11 @@ Text: {#await base64toBlob(content.attachment.data, content.attachment.contentType) then url} PDF present: {#if content.attachment && content.attachment.creation} - Date PDF created: {new Date(content.attachment.creation).toISOString().slice(0,10)}. + PDF created: {new Date(content.attachment.creation).toISOString().slice(0,10)}. {/if} {#if resource.pdfSignedDate} - Date PDF signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)}. + PDF signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)}. {/if} View {/await} From b86bb2d2a2ba311eb384339f8c83c42c1fa3eba5 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Thu, 18 Jul 2024 10:07:03 -0700 Subject: [PATCH 09/29] As presented at report out. --- src/lib/resource-templates/AdvanceDirective.svelte | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index b0799f6b..1a067226 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -72,17 +72,20 @@ Text: {/if}
{#if resource.content} + {#each resource.content as content} {#if content.attachment && content.attachment.contentType === "application/pdf" && content.attachment.data} {#await base64toBlob(content.attachment.data, content.attachment.contentType) then url} - PDF present: {#if content.attachment && content.attachment.creation} - PDF created: {new Date(content.attachment.creation).toISOString().slice(0,10)}. + Created: {new Date(content.attachment.creation).toISOString().slice(0,10)} +
{/if} {#if resource.pdfSignedDate} - - PDF signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)}. + Digitally signed: {new Date(resource.pdfSignedDate).toISOString().slice(0,10)} +
{/if} + PDF present: View {/await} {/if} From 2c4499e04a1f2cbc5b61af5063612ed1c33df8f4 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Fri, 20 Sep 2024 18:32:37 -0400 Subject: [PATCH 10/29] AD: Implement the beginnings of handling revocation / revoke per https://github.com/uwcirg/shl-ips/issues/30 --- src/lib/resource-templates/AdvanceDirective.svelte | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 1a067226..662597cf 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -62,6 +62,17 @@ Text: {resource.status} {/if}
+ + +{#if resource.extension} + {#each resource.extension as ext} + {#if ext.url == 'http://hl7.org/fhir/us/pacio-adi/StructureDefinition/adi-document-revoke-status-extension'} + Revoke Status: {ext.valueCoding.code} +
+ {/if} + {/each} +{/if} + docStatus: {#if resource.docStatus} {resource.docStatus} From e54b2a1784a36ff8b0465c1332ec38e1e00a60b1 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sat, 21 Sep 2024 12:05:03 -0700 Subject: [PATCH 11/29] Saturday Connectathon, code in find resources for POLST structured data. Not working quite yet... --- src/lib/FetchAD.svelte | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index d24eb94a..2ee1d974 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -282,6 +282,36 @@ } } + async function fetchResourceByUrl(url) { + return result = await fetch(url, { + method: 'GET', + headers: { accept: 'application/json' } + }).then(function (response: any) { + if (!response.ok) { + // make the promise be rejected if we didn't get a 2xx response + //throw new Error('Unable to fetch ', { cause: response }); + console.error(`Failed to fetch resource from ${url}`); + } else { + return response; + } + }); + } + +/** + async function fetchResourceByUrl(url) { + try { + const response = await fetch(url); + if (response.ok) { + return response; + } else { + console.error(`Failed to fetch resource from ${url}`); + } + } catch (error) { + console.error(`Error fetching resource from ${url}:`, error); + } + } +*/ + async function prepareIps() { fetchError = ''; processing = true; @@ -338,6 +368,9 @@ // if one of the DR's `content` elements has attachment.contentType = 'application/pdf', download if possible, put base64 of pdf in DR.content.attachment.data const hasPdfContent = dr => dr.content && dr.content.some(content => content.attachment && content.attachment.contentType === 'application/pdf' && !content.attachment.data); + // if one of the DR's + const isPolst = dr => dr.type && dr.type.coding && dr.type.coding.some(coding => coding.system === 'http://loinc.org' && coding.code === '100821-8'); + resources.forEach(async dr => { if (hasPdfContent(dr)) { const pdfContent = dr.content.find(content => content.attachment && content.attachment.contentType === 'application/pdf'); @@ -346,6 +379,32 @@ } } }); + resources.forEach(async dr => { + // If this DR is a POLST, add the following chain of queries: + if (isPolst(dr)){ + // In the POLST find the content[] with format.code = "urn:hl7-org:pe:adipmo-structuredBody:1.1" (ADIPMO Structured Body Bundle), + const contentAdipmoBundleRef = dr.content.find(content => content.format && content.format.code && content.format.code === 'urn:hl7-org:pe:adipmo-structuredBody:1.1'); + if (contentAdipmoBundleRef) { + // look in that content's attachment.url, that will point at a Bundle (e.g. https://qa-rr-fhir2.maxmddirect.com/Bundle/10f4ff31-2c24-414d-8d70-de3a86bed808?_format=json) + const adipmoBundleUrl = contentAdipmoBundleRef.attachment.url; + // Pull that Bundle. + let adipmoBundle; + adipmoBundle = await fetchResourceByUrl(adipmoBundleUrl); + let adipmoBundleJson; + //adipmoBundleJson = await adipmoBundle.json(); + adipmoBundleJson = adipmoBundle.json(); + // That bundle will include ServiceRequest resources. + const serviceRequest = adipmoBundleJson.entry.find(entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' && entry.category[0].coding[0].code === '100822-6'); + //serviceRequests.forEach( serviceRequest => { + //const serviceRequestCpr = serviceRequests.find(serviceRequests => serviceRequests.category.coding.code "100822-6" (system http://loinc.org) - that's the one for CPR. + //const isCpr = serviceRequest.category[0].coding[0].code === '100822-6'; + const doNotPerform = serviceRequest.doNotPerform && serviceRequest.doNotPerform == true; + dr.isCpr = isCpr; + dr.doNotPerform = doNotPerform; + //}); + } + } + }); updateAdSection(resources); // resources.unshift(patient); result = { From d4c803221bea05fa72cb2897933d3dc5ca76bbc4 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sat, 21 Sep 2024 15:13:27 -0700 Subject: [PATCH 12/29] Seems like my requests for structured data are working now, but there may still be data issues due to async/wait... --- src/lib/FetchAD.svelte | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index 2ee1d974..f76cdbbb 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -368,31 +368,27 @@ // if one of the DR's `content` elements has attachment.contentType = 'application/pdf', download if possible, put base64 of pdf in DR.content.attachment.data const hasPdfContent = dr => dr.content && dr.content.some(content => content.attachment && content.attachment.contentType === 'application/pdf' && !content.attachment.data); - // if one of the DR's + // if one of the DR's const isPolst = dr => dr.type && dr.type.coding && dr.type.coding.some(coding => coding.system === 'http://loinc.org' && coding.code === '100821-8'); - resources.forEach(async dr => { - if (hasPdfContent(dr)) { - const pdfContent = dr.content.find(content => content.attachment && content.attachment.contentType === 'application/pdf'); - if (pdfContent && pdfContent.attachment && pdfContent.attachment.url) { - await injectPdfIntoDocRef (pdfContent.attachment.url, pdfContent.attachment); - } - } - }); resources.forEach(async dr => { // If this DR is a POLST, add the following chain of queries: if (isPolst(dr)){ // In the POLST find the content[] with format.code = "urn:hl7-org:pe:adipmo-structuredBody:1.1" (ADIPMO Structured Body Bundle), - const contentAdipmoBundleRef = dr.content.find(content => content.format && content.format.code && content.format.code === 'urn:hl7-org:pe:adipmo-structuredBody:1.1'); + const contentAdipmoBundleRef = dr.content.find(content => content.format && content.format.code && content.format.code === 'urn:hl7-org:pe:adipmo-structuredBody:1.1' && content.attachment && content.attachment.url && content.attachment.url.includes('Bundle')); if (contentAdipmoBundleRef) { // look in that content's attachment.url, that will point at a Bundle (e.g. https://qa-rr-fhir2.maxmddirect.com/Bundle/10f4ff31-2c24-414d-8d70-de3a86bed808?_format=json) const adipmoBundleUrl = contentAdipmoBundleRef.attachment.url; // Pull that Bundle. - let adipmoBundle; - adipmoBundle = await fetchResourceByUrl(adipmoBundleUrl); - let adipmoBundleJson; - //adipmoBundleJson = await adipmoBundle.json(); - adipmoBundleJson = adipmoBundle.json(); + //let adipmoBundle; + /**adipmoBundle = await Promise.all([ + fetchResourceByUrl(adipmoBundleUrl) + ]);*/ + let adipmoBundle = await fetchResourceByUrl(adipmoBundleUrl); + //if (adipmoBundle.json() != undefined){ + let adipmoBundleJson = await adipmoBundle.json(); + //adipmoBundleJson = adipmoBundle.json(); + //adipmoBundleJson = adipmoBundle; // That bundle will include ServiceRequest resources. const serviceRequest = adipmoBundleJson.entry.find(entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' && entry.category[0].coding[0].code === '100822-6'); //serviceRequests.forEach( serviceRequest => { @@ -402,6 +398,15 @@ dr.isCpr = isCpr; dr.doNotPerform = doNotPerform; //}); + //} + } + } + }); + resources.forEach(async dr => { + if (hasPdfContent(dr)) { + const pdfContent = dr.content.find(content => content.attachment && content.attachment.contentType === 'application/pdf'); + if (pdfContent && pdfContent.attachment && pdfContent.attachment.url) { + await injectPdfIntoDocRef (pdfContent.attachment.url, pdfContent.attachment); } } }); From 4f2ce5ba3856942f550eb6d8e4b68a76bd32c986 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sat, 21 Sep 2024 19:53:25 -0700 Subject: [PATCH 13/29] Finally reading structured data from the POLST, still needs a lot of refinement. --- src/lib/FetchAD.svelte | 9 ++++++--- src/lib/resource-templates/AdvanceDirective.svelte | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index f76cdbbb..99694f91 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -374,6 +374,7 @@ resources.forEach(async dr => { // If this DR is a POLST, add the following chain of queries: if (isPolst(dr)){ + dr.isPolst = true; // In the POLST find the content[] with format.code = "urn:hl7-org:pe:adipmo-structuredBody:1.1" (ADIPMO Structured Body Bundle), const contentAdipmoBundleRef = dr.content.find(content => content.format && content.format.code && content.format.code === 'urn:hl7-org:pe:adipmo-structuredBody:1.1' && content.attachment && content.attachment.url && content.attachment.url.includes('Bundle')); if (contentAdipmoBundleRef) { @@ -390,12 +391,14 @@ //adipmoBundleJson = adipmoBundle.json(); //adipmoBundleJson = adipmoBundle; // That bundle will include ServiceRequest resources. - const serviceRequest = adipmoBundleJson.entry.find(entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' && entry.category[0].coding[0].code === '100822-6'); + const serviceRequest = adipmoBundleJson.entry.find( + entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' + && entry.resource.category && entry.resource.category[0].coding[0].code === '100822-6'); //serviceRequests.forEach( serviceRequest => { //const serviceRequestCpr = serviceRequests.find(serviceRequests => serviceRequests.category.coding.code "100822-6" (system http://loinc.org) - that's the one for CPR. //const isCpr = serviceRequest.category[0].coding[0].code === '100822-6'; - const doNotPerform = serviceRequest.doNotPerform && serviceRequest.doNotPerform == true; - dr.isCpr = isCpr; + const doNotPerform = serviceRequest.resource.doNotPerform && serviceRequest.resource.doNotPerform == true; + //dr.isCpr = isCpr; dr.doNotPerform = doNotPerform; //}); //} diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 662597cf..ca2fae47 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -82,6 +82,16 @@ Text: {resource.description.text} {/if}
+ +{#if resource.isPolst} +This is a POLST. +
+{#if resource.doNotPerform} + doNotPerform = true. +{/if} +{/if} +
+ {#if resource.content} From 4a73c7e28a5919e24675304585b7ca3049dbb922 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sat, 21 Sep 2024 20:31:02 -0700 Subject: [PATCH 14/29] AD: POLST structured data for CPR do / do not perform on properly read and displayed. --- src/lib/FetchAD.svelte | 21 +++++-------------- .../AdvanceDirective.svelte | 8 ++++--- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index 99694f91..28612bdf 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -381,27 +381,16 @@ // look in that content's attachment.url, that will point at a Bundle (e.g. https://qa-rr-fhir2.maxmddirect.com/Bundle/10f4ff31-2c24-414d-8d70-de3a86bed808?_format=json) const adipmoBundleUrl = contentAdipmoBundleRef.attachment.url; // Pull that Bundle. - //let adipmoBundle; - /**adipmoBundle = await Promise.all([ - fetchResourceByUrl(adipmoBundleUrl) - ]);*/ let adipmoBundle = await fetchResourceByUrl(adipmoBundleUrl); - //if (adipmoBundle.json() != undefined){ let adipmoBundleJson = await adipmoBundle.json(); - //adipmoBundleJson = adipmoBundle.json(); - //adipmoBundleJson = adipmoBundle; - // That bundle will include ServiceRequest resources. + // That bundle will include ServiceRequest resources; look for the one for CPR (loinc 100822-6) const serviceRequest = adipmoBundleJson.entry.find( entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' && entry.resource.category && entry.resource.category[0].coding[0].code === '100822-6'); - //serviceRequests.forEach( serviceRequest => { - //const serviceRequestCpr = serviceRequests.find(serviceRequests => serviceRequests.category.coding.code "100822-6" (system http://loinc.org) - that's the one for CPR. - //const isCpr = serviceRequest.category[0].coding[0].code === '100822-6'; - const doNotPerform = serviceRequest.resource.doNotPerform && serviceRequest.resource.doNotPerform == true; - //dr.isCpr = isCpr; - dr.doNotPerform = doNotPerform; - //}); - //} + dr.isCpr = false; + if (serviceRequest !== undefined) dr.isCpr = true; + + dr.doNotPerform = serviceRequest.resource.doNotPerform && serviceRequest.resource.doNotPerform == true; } } }); diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index ca2fae47..884024b0 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -84,10 +84,12 @@ Text:
{#if resource.isPolst} -This is a POLST. -
+{#if resource.isCpr} {#if resource.doNotPerform} - doNotPerform = true. + This includes a directive to NOT perform CPR. +{:else} + This includes a directive to perform CPR. +{/if} {/if} {/if}
From 4eb03d92e418f13e36dfbff93f2505c7b951dd02 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sun, 22 Sep 2024 07:18:58 -0700 Subject: [PATCH 15/29] AD: POLST structured data now functional for all 4 available detailed elements. --- src/lib/FetchAD.svelte | 40 +++++++++++++-- .../AdvanceDirective.svelte | 50 +++++++++++++++++-- 2 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/lib/FetchAD.svelte b/src/lib/FetchAD.svelte index 28612bdf..a7aa025c 100644 --- a/src/lib/FetchAD.svelte +++ b/src/lib/FetchAD.svelte @@ -383,14 +383,46 @@ // Pull that Bundle. let adipmoBundle = await fetchResourceByUrl(adipmoBundleUrl); let adipmoBundleJson = await adipmoBundle.json(); - // That bundle will include ServiceRequest resources; look for the one for CPR (loinc 100822-6) - const serviceRequest = adipmoBundleJson.entry.find( + + // TODO The next 4 sections should be generalized into an iteration, just need carve out for "detail" for 2. + + // That bundle will include ServiceRequest resources; look for the one for CPR (loinc 100822-6) + const serviceRequestCpr = adipmoBundleJson.entry.find( entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' && entry.resource.category && entry.resource.category[0].coding[0].code === '100822-6'); dr.isCpr = false; - if (serviceRequest !== undefined) dr.isCpr = true; + if (serviceRequestCpr !== undefined) dr.isCpr = true; + dr.doNotPerformCpr = serviceRequestCpr.resource.doNotPerform && serviceRequestCpr.resource.doNotPerform == true; + + // That bundle will include ServiceRequest resources; look for the one for "Initial portable medical treatment orders" (loinc 100823-4) aka Comfort Treatments + const serviceRequestComfortTreatments = adipmoBundleJson.entry.find( + entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' + && entry.resource.category && entry.resource.category[0].coding[0].code === '100823-4'); + dr.isComfortTreatments = false; + if (serviceRequestComfortTreatments !== undefined) dr.isComfortTreatments = true; + dr.doNotPerformComfortTreatments = serviceRequestComfortTreatments.resource.doNotPerform && serviceRequestComfortTreatments.resource.doNotPerform == true; + + dr.detailComfortTreatments = serviceRequestComfortTreatments.resource.note[0].text; + + // That bundle will include ServiceRequest resources; look for the one for "Additional..." (loinc 100824-2) + const serviceRequestAdditionalTx = adipmoBundleJson.entry.find( + entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' + && entry.resource.category && entry.resource.category[0].coding[0].code === '100824-2'); + dr.isAdditionalTx = false; + if (serviceRequestAdditionalTx !== undefined) dr.isAdditionalTx = true; + dr.doNotPerformAdditionalTx = serviceRequestAdditionalTx.resource.doNotPerform && serviceRequestAdditionalTx.resource.doNotPerform == true; + + dr.detailAdditionalTx = serviceRequestAdditionalTx.resource.orderDetail[0].text; + + // That bundle will include ServiceRequest resources; look for the one for "Medically assisted nutrition orders" (loinc 100825-9) + const serviceRequestMedicallyAssisted = adipmoBundleJson.entry.find( + entry => entry.resource && entry.resource.resourceType === 'ServiceRequest' + && entry.resource.category && entry.resource.category[0].coding[0].code === '100825-9'); + dr.isMedicallyAssisted = false; + if (serviceRequestMedicallyAssisted !== undefined) dr.isMedicallyAssisted = true; + dr.doNotPerformMedicallyAssisted = serviceRequestMedicallyAssisted.resource.doNotPerform && serviceRequestMedicallyAssisted.resource.doNotPerform == true; - dr.doNotPerform = serviceRequest.resource.doNotPerform && serviceRequest.resource.doNotPerform == true; + dr.detailMedicallyAssisted = serviceRequestMedicallyAssisted.resource.orderDetail[0].text; } } }); diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 884024b0..93a98455 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -84,16 +84,58 @@ Text:
{#if resource.isPolst} -{#if resource.isCpr} -{#if resource.doNotPerform} - This includes a directive to NOT perform CPR. +
+ + POLST Details: +
+
    + {#if resource.isCpr} +
      +{#if resource.doNotPerformCpr} + This includes a directive to NOT perform CPR. {:else} - This includes a directive to perform CPR. + This includes a directive to perform CPR. {/if} +
    {/if} +
    + +{#if resource.isComfortTreatments} +
      +{#if resource.doNotPerformComfortTreatments} + This includes a directive to NOT perform comfort-focused treatments: {@html resource.detailComfortTreatments} +{:else} + This includes a directive to perform comfort-focused treatments: {@html resource.detailComfortTreatments} +{/if} +
    {/if}
    +{#if resource.isAdditionalTx} +
      +{#if resource.doNotPerformAdditionalTx} + This includes a directive to NOT perform additional treatments: {@html resource.detailAdditionalTx} +{:else} + This includes a directive to perform additional treatments: {@html resource.detailAdditionalTx} +{/if} +
    +{/if} +
    + +{#if resource.isMedicallyAssisted} +
      +{#if resource.doNotPerformMedicallyAssisted} + This includes a directive to NOT perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} +{:else} + This includes a directive to perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} +{/if} +
    +{/if} +
+
+
+{/if} + {#if resource.content} From 014e99827358dde39cbf194551d030da62d7cc79 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sun, 22 Sep 2024 07:30:45 -0700 Subject: [PATCH 16/29] AD: Removed: "Digitally signed" (not relevant). TODO: Add signed by ("legal authenticator"), on this date (also in that block): --- src/lib/resource-templates/AdvanceDirective.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 93a98455..d937078e 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -87,6 +87,7 @@ Text:
POLST Details: +

    {#if resource.isCpr} @@ -147,8 +148,10 @@ Text:
    {/if} {#if resource.pdfSignedDate} + {/if} PDF present: View From 3ec29a1b10bef06f1e9d49f7f4215b50b8929f7d Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sun, 22 Sep 2024 08:04:26 -0700 Subject: [PATCH 17/29] DO NOT PULL THIS: testing sometthing, this is broken. --- .../AdvanceDirective.svelte | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index d937078e..6873bd50 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -1,8 +1,20 @@ +{#if isRevoked} +
    +{/if} + {/if} From e5d067a77b726a6670d918a48a6ed7095167d155 Mon Sep 17 00:00:00 2001 From: Justin McReynolds Date: Sun, 22 Sep 2024 09:43:57 -0700 Subject: [PATCH 21/29] AS RECORDED IN REPORT-OUT VIDEO. Changes "directive" in POLST to order. --- .../resource-templates/AdvanceDirective.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/resource-templates/AdvanceDirective.svelte b/src/lib/resource-templates/AdvanceDirective.svelte index 1db257e3..e42107a8 100644 --- a/src/lib/resource-templates/AdvanceDirective.svelte +++ b/src/lib/resource-templates/AdvanceDirective.svelte @@ -115,9 +115,9 @@ Text: {#if resource.isCpr}
      {#if resource.doNotPerformCpr} - This includes a directive to NOT perform CPR. + This includes an order to NOT perform CPR. {:else} - This includes a directive to perform CPR. + This includes an order to perform CPR. {/if}
    {/if} @@ -126,9 +126,9 @@ Text: {#if resource.isComfortTreatments}
      {#if resource.doNotPerformComfortTreatments} - This includes a directive to NOT perform comfort-focused treatments: {@html resource.detailComfortTreatments} + This includes an order to NOT perform comfort-focused treatments: {@html resource.detailComfortTreatments} {:else} - This includes a directive to perform comfort-focused treatments: {@html resource.detailComfortTreatments} + This includes an order to perform comfort-focused treatments: {@html resource.detailComfortTreatments} {/if}
    {/if} @@ -137,9 +137,9 @@ Text: {#if resource.isAdditionalTx}
      {#if resource.doNotPerformAdditionalTx} - This includes a directive to NOT perform additional treatments: {@html resource.detailAdditionalTx} + This includes an order to NOT perform additional treatments: {@html resource.detailAdditionalTx} {:else} - This includes a directive to perform additional treatments: {@html resource.detailAdditionalTx} + This includes an order to perform additional treatments: {@html resource.detailAdditionalTx} {/if}
    {/if} @@ -148,9 +148,9 @@ Text: {#if resource.isMedicallyAssisted}
      {#if resource.doNotPerformMedicallyAssisted} - This includes a directive to NOT perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} + This includes an order to NOT perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} {:else} - This includes a directive to perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} + This includes an order to perform medically assisted nutrition: {@html resource.detailMedicallyAssisted} {/if}
    {/if} From 60f0c4db377c4cd022341c0d2c71ead374f5c989 Mon Sep 17 00:00:00 2001 From: daniellrgn Date: Sun, 22 Sep 2024 11:00:45 -0700 Subject: [PATCH 22/29] Add peter jordan's record --- src/lib/config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/config.ts b/src/lib/config.ts index 28440ab6..951ee2ad 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -91,7 +91,8 @@ export const VIEWER_BASE = new URL( window.location.href ).toString(); export const PATIENT_IPS = { - 'Dave deBronkart': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/16501/$summary' + 'Dave deBronkart': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/16501/$summary', + 'Peter Kieth Jordan': 'https://terminz.azurewebsites.net/fhir/Patient/$summary?profile=http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips&identifier=https://standards.digital.health.nz/ns/nhi-id|NNJ9186&_format=json' } export const EXAMPLE_IPS = { 'Maria SEATTLE Gravitate': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/14599/$summary', From 3b96acae78f3b5805f2be0d41eefec8a266a6cc5 Mon Sep 17 00:00:00 2001 From: daniellrgn Date: Sun, 22 Sep 2024 11:40:44 -0700 Subject: [PATCH 23/29] Add meditech sample endpoint --- default.env | 3 +++ src/env.d.ts | 1 + src/lib/FetchUrl.svelte | 8 ++++++-- src/lib/config.ts | 7 ++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/default.env b/default.env index 48353bcf..d71718c7 100644 --- a/default.env +++ b/default.env @@ -37,6 +37,9 @@ COMPOSE_FILE=docker-compose.yaml:docker-compose.static-ingress.yaml VITE_EPIC_CLIENT_ID= VITE_CERNER_CLIENT_ID= +# Bearer auth tokens +VITE_MEDITECH_BEARER_TOKEN= + # HIMSS 2024 only: #VITE_EPIC_HIMSS_CLIENT_ID= #VITE_ECW_HIMSS_CLIENT_ID= diff --git a/src/env.d.ts b/src/env.d.ts index 6475dcb1..8a05826f 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -5,6 +5,7 @@ interface ImportMetaEnv { readonly VITE_ECW_HIMSS_CLIENT_ID: string readonly VITE_EPIC_CLIENT_ID: string readonly VITE_CERNER_CLIENT_ID: string + readonly VITE_MEDITECH_BEARER_TOKEN: string readonly VITE_API_BASE: string readonly VITE_VIEWER_BASE: string readonly VITE_INTERMEDIATE_FHIR_SERVER_BASE: string diff --git a/src/lib/FetchUrl.svelte b/src/lib/FetchUrl.svelte index 7def9a53..dd12d7ce 100644 --- a/src/lib/FetchUrl.svelte +++ b/src/lib/FetchUrl.svelte @@ -13,7 +13,7 @@ Row, Spinner } from 'sveltestrap'; - import { PATIENT_IPS, EXAMPLE_IPS, IPS_DEFAULT } from './config'; + import { PATIENT_IPS, EXAMPLE_IPS, IPS_DEFAULT, BEARER_AUTHORIZATION } from './config'; import type { SHCRetrieveEvent, IPSRetrieveEvent } from './types'; import { createEventDispatcher } from 'svelte'; @@ -53,8 +53,12 @@ try { let content; let hostname; + let headers: any = { accept: 'application/fhir+json' }; + if (summaryUrlValidated?.toString().includes('meditech')) { + headers['authorization'] = `Bearer ${BEARER_AUTHORIZATION['Meditech']}` + } const contentResponse = await fetch(summaryUrlValidated!, { - headers: { accept: 'application/fhir+json' } + headers: headers }).then(function(response) { if (!response.ok) { // make the promise be rejected if we didn't get a 2xx response diff --git a/src/lib/config.ts b/src/lib/config.ts index 951ee2ad..c01c901f 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -42,6 +42,10 @@ export const SOF_HOSTS = [ note: "Credentials provided" } ]; + +export const BEARER_AUTHORIZATION = { + 'Meditech': import.meta.env.VITE_MEDITECH_BEARER_TOKEN +} export const SOF_REDIRECT_URI = '/create'; export const SOF_RESOURCES = [ 'Patient', @@ -97,7 +101,8 @@ export const PATIENT_IPS = { export const EXAMPLE_IPS = { 'Maria SEATTLE Gravitate': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/14599/$summary', 'Martha Mum': 'https://hl7-ips-server.hl7.org/fhir/Patient/15/$summary', - 'Peter Keith Jones': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/11013/$summary', + 'Meditech 1': 'https://dev-mtx-interop.meditech.com:443/v2/ips/STU1/Patient/f3b430be-1f8a-53d3-8261-4ffbafa05a61/$summary', + // 'Meditech 2': 'https://dev-mtx-interop.meditech.com:443/v2/ips/STU1/Patient/9bad7dc5-47ad-5022-82e7-0cb0aab13ee9/$summary', // Error returned 'Angela Roster': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/10965/$summary', 'Horace Skelly': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/11142/$summary', 'Anonymous': 'https://fhir.ips-demo.dev.cirg.uw.edu/fhir/Patient/10999/$summary', From 1477bbf347d62cb15fd188dd0289573402d3625d Mon Sep 17 00:00:00 2001 From: daniellrgn Date: Sun, 22 Sep 2024 11:40:54 -0700 Subject: [PATCH 24/29] Add flag resource --- src/lib/resourceUploader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/resourceUploader.js b/src/lib/resourceUploader.js index 4ebf3a7c..ee17e31a 100644 --- a/src/lib/resourceUploader.js +++ b/src/lib/resourceUploader.js @@ -12,6 +12,7 @@ const allowableResourceTypes = [ 'DiagnosticReport', 'DocumentReference', 'Encounter', + 'Flag', 'Immunization', 'Location', 'Media', From 8241cde1f03dbf5d444ba8fdd13fd414d24db45f Mon Sep 17 00:00:00 2001 From: Daniel Lorigan Date: Sun, 22 Sep 2024 16:07:29 -0300 Subject: [PATCH 25/29] Add "prototype" to header title --- src/routes/+layout.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 51d46010..a1943b05 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -169,7 +169,7 @@ WA Verify Logo -
    International Patient Summary
    +
    International Patient Summary Prototype
    From 9a80070270029c083a5281e5ada780977d5e061b Mon Sep 17 00:00:00 2001 From: daniellrgn Date: Sun, 22 Sep 2024 12:41:08 -0700 Subject: [PATCH 26/29] Add version string support --- default.env | 2 ++ src/env.d.ts | 1 + src/lib/config.ts | 2 ++ src/routes/+layout.svelte | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/default.env b/default.env index d71718c7..bfb0e95d 100644 --- a/default.env +++ b/default.env @@ -27,6 +27,8 @@ COMPOSE_FILE=docker-compose.yaml:docker-compose.static-ingress.yaml # Fully qualified domain name; used to configure traefik ingress # SERVER_NAME=foo.cirg.uw.edu +VITE_VERSION_STRING= + ### ### Client environment variables: ### Variables with VITE_ prefix will be available to the client diff --git a/src/env.d.ts b/src/env.d.ts index 8a05826f..24d6b69a 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -9,6 +9,7 @@ interface ImportMetaEnv { readonly VITE_API_BASE: string readonly VITE_VIEWER_BASE: string readonly VITE_INTERMEDIATE_FHIR_SERVER_BASE: string + readonly VITE_VERSION_STRING: string readonly DEV_SERVER_PORT: number } diff --git a/src/lib/config.ts b/src/lib/config.ts index c01c901f..34929310 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -5,6 +5,8 @@ export const API_BASE = import.meta.env.VITE_API_BASE; export const INTERMEDIATE_FHIR_SERVER_BASE = import.meta.env.VITE_INTERMEDIATE_FHIR_SERVER_BASE; +export const VERSION_STRING = import.meta.env.VITE_VERSION_STRING; + export const SOF_HOSTS = [ // { // id: "epic-himss", diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a1943b05..7036eca2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -22,6 +22,7 @@ Styles } from 'sveltestrap'; import { SHLClient, type SHLAdminParams } from '$lib/managementClient'; + import { VERSION_STRING } from '../lib/config'; const LOCAL_STORAGE_KEY = 'shlips_store_shls'; let shlStore = writable( @@ -192,7 +193,7 @@ document. SHLinks can be shared by copy/paste, or by presenting a QR code. Source code and license at https://github.com/uwcirg/shl-ips. + >. Site version: {VERSION_STRING} From ed3816fd7954a6af6dddf8017ec464df395ca403 Mon Sep 17 00:00:00 2001 From: Daniel Lorigan Date: Tue, 24 Sep 2024 17:06:08 -0700 Subject: [PATCH 27/29] Fix Meld key name; Remove broken HAPI endpoint; Fix Cerner data ingestion; Fix request id; Fix POU header for Epic --- src/lib/FetchTEFCA.svelte | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/FetchTEFCA.svelte b/src/lib/FetchTEFCA.svelte index e3202c8d..439cd2bc 100644 --- a/src/lib/FetchTEFCA.svelte +++ b/src/lib/FetchTEFCA.svelte @@ -17,15 +17,16 @@ const resourceDispatch = createEventDispatcher<{ 'update-resources': ResourceRetrieveEvent }>(); let sources = { - Meld: {selected: false, destination: "Meld", url: "https://gw.interop.community/HeliosConnectathonSa/open"}, + MeldOpen: {selected: false, destination: "MeldOpen", url: "https://gw.interop.community/HeliosConnectathonSa/open"}, JMCHelios: {selected: false, destination: "JMCHelios", url: "https://gw.interop.community/JMCHeliosSTISandbox/open"}, - PublicHapi: {selected: false, destination: "PublicHapi", url: "http://hapi.fhir.org/baseR4"}, + // Patient no longer exists + // PublicHapi: {selected: false, destination: "PublicHapi", url: "http://hapi.fhir.org/baseR4"}, OpenEpic: {selected: false, destination: "OpenEpic", url: ""}, CernerHelios: {selected: false, destination: "CernerHelios", url: ""} } let baseUrl = "https://concept01.ehealthexchange.org:52780/fhirproxy/r4"; - let selectedSource = "Meld"; + let selectedSource = "MeldOpen"; let method = 'destination'; // url or destination let processing = false; let fetchError = ''; @@ -74,7 +75,7 @@ zip = ''; phone = ''; gender = ''; - if (selectedSource === 'Meld') { + if (selectedSource === 'MeldOpen') { last = "BLACKSTONE"; first = "VERONICA"; gender = "Female"; @@ -95,6 +96,7 @@ gender = "Female"; dob = "2023-08-29"; } else if (selectedSource === 'PublicHapi') { + // Patient/test data no longer available last = "Sanity"; first = "TestforPatientR4"; gender = "Male"; @@ -107,7 +109,7 @@ $: { if (method) { - if (method === 'url' && selectedSource &&sources[selectedSource].url === "") { + if (method === 'url' && selectedSource && sources[selectedSource].url === "") { selectedSource = ""; } } @@ -191,9 +193,9 @@ if (method === 'url') { url = sources[selectedSource].url; } else if (method === 'destination') { - headers['X-Request-Id'] = '5c92758f-79c8-4137-b104-9c0064205407', - headers['X-DESTINATION'] = selectedSource, - headers['X-POU'] = 'PUBHLTH' + headers['X-Request-Id'] = '21143678-7bd5-4caa-bdae-ee35a409d4f2'; + headers['X-DESTINATION'] = selectedSource; + headers['X-POU'] = (selectedSource === 'OpenEpic' ? 'TREAT' : 'PUBHLTH'); } let query = buildPatientSearchQuery(); @@ -227,9 +229,9 @@ if (method === 'url') { url = sources[selectedSource].url; } else if (method === 'destination') { - headers['X-Request-Id'] = '5c92758f-79c8-4137-b104-9c0064205407', - headers['X-DESTINATION'] = selectedSource, - headers['X-POU'] = 'PUBHLTH' + headers['X-Request-Id'] = '21143678-7bd5-4caa-bdae-ee35a409d4f2'; + headers['X-DESTINATION'] = selectedSource; + headers['X-POU'] = (selectedSource === 'OpenEpic' ? 'TREAT' : 'PUBHLTH'); } let results = await Promise.allSettled( @@ -259,7 +261,7 @@ let resources = resultJson.filter(x => x.status == "fulfilled").map(x => x.value); resources = resources.map((r) => { if (r.resourceType === "Bundle") { - if (r.total == 0) { + if (r.total == 0 || !r.entry) { return []; } else { return r.entry.map(e => e.resource); From c547f1eceb38b8493a8d4ddee12f1c78b019e63c Mon Sep 17 00:00:00 2001 From: Daniel Lorigan Date: Mon, 7 Oct 2024 16:59:59 -0700 Subject: [PATCH 28/29] Fix undefined address line in Patient resource template Add additional check for patient contact address line --- src/lib/resource-templates/Patient.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/resource-templates/Patient.svelte b/src/lib/resource-templates/Patient.svelte index 3f216035..e2032d75 100644 --- a/src/lib/resource-templates/Patient.svelte +++ b/src/lib/resource-templates/Patient.svelte @@ -125,9 +125,11 @@ {contact.address.use ?? ""} - {#each contact.address.line as line} - {line}
    - {/each} + {#if contact.address.line} + {#each contact.address.line as line} + {line}
    + {/each} + {/if} {contact.address.city ?? "[Unknown City]"}{ contact.address.state ? `, ${contact.address.state}` From 5838716556390a2c024b0a797b8117e6f24d788c Mon Sep 17 00:00:00 2001 From: Daniel Lorigan Date: Wed, 9 Oct 2024 15:20:47 -0700 Subject: [PATCH 29/29] Docker debug (#41) * Add environment variable to run in dev mode * Update env var name * Remove env from dockerfile cmd * Add sourcemap option for production build * Add DEBUG env var to .env * Update default.env * Add chrome suggestion to debug option in env file --- Dockerfile | 2 +- default.env | 4 ++++ vite.config.ts | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad82add7..0d4f3ec9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,4 +16,4 @@ RUN npm run build RUN cp build/404.html build/index.html -CMD ["sh", "-c", "npm run build && cp build/404.html build/index.html && npm run start"] \ No newline at end of file +CMD npm run build && cp build/404.html build/index.html && npm run start diff --git a/default.env b/default.env index bfb0e95d..97a0e2e4 100644 --- a/default.env +++ b/default.env @@ -29,6 +29,10 @@ COMPOSE_FILE=docker-compose.yaml:docker-compose.static-ingress.yaml VITE_VERSION_STRING= +# Debug option for non-prod deployments using /build output +# (Works best in Chrome) +# DEBUG=1 + ### ### Client environment variables: ### Variables with VITE_ prefix will be available to the client diff --git a/vite.config.ts b/vite.config.ts index 8f370b26..509bd8dc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,6 +12,9 @@ export default defineConfig(({ mode }) => { server: { host: true, port: process.env.DEV_SERVER_PORT ? process.env.DEV_SERVER_PORT : 3000 + }, + build: { + sourcemap: process.env.DEBUG ?? false } } -}); \ No newline at end of file +});