Skip to content

Commit 9ba7d0a

Browse files
committed
Fixes for invalidating shl on request and when more recent summary is ready
1 parent c5b63cb commit 9ba7d0a

File tree

4 files changed

+10
-30
lines changed

4 files changed

+10
-30
lines changed

src/lib/AddFileLTT.svelte

+4-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@
5656
// TODO: Get summary DocumentReferences from resourcesToReview
5757
let summaryDocRefs: any[] = resourcesToReview.filter((r) => r.resourceType === "DocumentReference" && !(r.type?.coding[0]?.code === "34108-1"));
5858
// Compare sessionIDs in most recent DocRef with sessionID in most recent SHL
59-
let mostRecentDocRef = summaryDocRefs.sort((a, b) => b.date - a.date)[0];
59+
// let mostRecentDocRef = summaryDocRefs.sort((a, b) => b.date - a.date)[0];
60+
let mostRecentDocRef = summaryDocRefs[summaryDocRefs.length-1];
6061
// TODO: Get shl DocumentReferences from resourcesToReview
61-
let shlDocRefs: any[] = resourcesToReview.filter((r) => r.resourceType === "DocumentReference" && r.type?.coding[0]?.code === "34108-1");
62+
let shlDocRefs: any[] = resourcesToReview.filter((r) => r.resourceType === "DocumentReference" && r.type?.coding[0]?.code === "34108-1").reverse();
6263
6364
patientId = sofClient.getPatientID();
6465
sessionId = mostRecentDocRef.id;
@@ -114,8 +115,8 @@
114115
}
115116
}
116117
117-
console.log("Successfully retrieved SHL and Resources");
118118
if (found) {
119+
console.log("Successfully retrieved SHL and Resources");
119120
// The current SHL is most recent, so use it
120121
shlReadyDispatch('shl-ready', true);
121122
} else if (mostRecentDocRef) {

src/lib/HealthLinkLTT.svelte

+2-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import QRCode from 'qrcode';
3-
import { getContext } from 'svelte';
3+
import { getContext, setContext } from 'svelte';
44
import {
55
Button,
66
Card,
@@ -21,7 +21,6 @@
2121
Row
2222
} from 'sveltestrap';
2323
import { fade } from 'svelte/transition';
24-
import { goto } from '$app/navigation';
2524
import type { Writable } from 'svelte/store';
2625
import type { SHLAdminParams, SHLClient } from './managementClient';
2726
@@ -38,7 +37,6 @@
3837
let exp: Date;
3938
let today: Date;
4039
let expDisplay: string;
41-
let inactive = false;
4240
4341
$: {
4442
href = getUrl($shlStore);
@@ -86,7 +84,7 @@
8684
shlClient.deleteShl($shlStore);
8785
toggle();
8886
// TODO: Implement post-deactivation flow
89-
goto('/share');
87+
location.reload(true);
9088
}
9189
9290
async function renewShl() {}
@@ -213,25 +211,6 @@
213211
</div>
214212

215213
<style>
216-
img.qr {
217-
height: 100%;
218-
}
219-
p.logo {
220-
position: relative;
221-
width: 250px;
222-
height: 250px;
223-
}
224-
.logo {
225-
position: absolute;
226-
background: #325c33;
227-
width: 110px;
228-
height: 27px;
229-
/* padding: 2px; */
230-
left: calc(50% - 55px);
231-
top: calc(50% - 2em);
232-
border: 5px solid #325c33;
233-
box-sizing: border-box;
234-
}
235214
:global(.shlbutton) {
236215
width: 300px !important;
237216
}

src/lib/managementClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class SHLClient {
8181
}
8282
});
8383
const res = await req.json();
84-
return true;
84+
return res;
8585
}
8686

8787
async updateShl(shl: SHLAdminParams): Promise<boolean> {

src/lib/sofClient.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ export class SOFClient {
105105
const shlData = {
106106
id: shl.id,
107107
label: label,
108-
patientId: shl.userId,
108+
userId: shl.userId,
109109
sessionId: docRef.id,//shl.sessionId,
110110
managementToken: shl.managementToken,
111111
encryptionKey: shl.encryptionKey
112112
};
113113
const shlPayload = btoa(JSON.stringify(shlData));
114114
let shlDocRefInputs = {
115115
date: new Date().toISOString(),
116-
patientId: shl.userId,
116+
userId: shl.userId,
117117
documentReferenceId: docRef.id,
118118
data: shlPayload,
119119
label: label,
@@ -133,7 +133,7 @@ export class SOFClient {
133133
]
134134
},
135135
"subject": {
136-
"reference": `Patient/${shl.userId}`
136+
"reference": `Patient?identifier=${shl.userId}`
137137
},
138138
"date": shlDocRefInputs.date,
139139
"description": "SMART Health Link Metadata",

0 commit comments

Comments
 (0)