Skip to content

Commit 5f6bd40

Browse files
committed
Handle errors and update insurance clientIDs
1 parent fd1e691 commit 5f6bd40

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

default.env

+7
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ COMPOSE_FILE=docker-compose.yaml:docker-compose.static-ingress.yaml
3434

3535
# SMART on FHIR client id configurations
3636
# Ensure that your development client is registered with the proper redirect uris
37+
#EHRs
3738
VITE_EPIC_CLIENT_ID=
3839
VITE_CERNER_CLIENT_ID=
3940

41+
#Insurance
42+
VITE_AETNA_CLIENT_ID=
43+
VITE_CAREFIRST_CLIENT_ID=
44+
VITE_HUMANA_CLIENT_ID=
45+
VITE_ACENTRA_CLIENT_ID=
46+
4047
# HIMSS 2024 only:
4148
#VITE_EPIC_HIMSS_CLIENT_ID=
4249
#VITE_ECW_HIMSS_CLIENT_ID=

src/env.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ interface ImportMetaEnv {
55
readonly VITE_ECW_HIMSS_CLIENT_ID: string
66
readonly VITE_EPIC_CLIENT_ID: string
77
readonly VITE_CERNER_CLIENT_ID: string
8+
readonly VITE_AETNA_CLIENT_ID: string
9+
readonly VITE_CAREFIRST_CLIENT_ID: string
10+
readonly VITE_HUMANA_CLIENT_ID: string
11+
readonly VITE_ACENTRA_CLIENT_ID: string
812
readonly VITE_API_BASE: string
913
readonly VITE_VIEWER_BASE: string
1014
readonly VITE_INTERMEDIATE_FHIR_SERVER_BASE: string

src/lib/FetchSoF.svelte

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
try {
3737
if (sofHost) {
3838
try {
39-
authorize(sofHost.url, sofHost.clientId, sofHost.clientSecret ?? undefined);
40-
authDispatch('sof-auth-init');
39+
authorize(sofHost.url, sofHost.clientId);// , sofHost.clientSecret);
40+
authDispatch('sof-auth-init', { data: true });
4141
} catch (e) {
42-
authDispatch('sof-auth-fail')
42+
authDispatch('sof-auth-fail', { data: false });
4343
}
4444
}
4545
} catch (e) {
@@ -82,7 +82,9 @@
8282
console.log(resources)
8383
processing = false;
8484
return resourceDispatch('update-resources', result);
85-
} catch (e) {
85+
} catch (e: any) {
86+
console.log(e.message);
87+
fetchError = e.message;
8688
processing = false;
8789
endSession();
8890
}

src/lib/config.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@ export const SOF_HOSTS = [
4545
id: "aetna",
4646
name: "AETNA Insurance Sandbox",
4747
url: "https://vteapif1.aetna.com/fhirdemo/v1/patientaccess",
48-
clientId: "09cbb76344009c25a2ec587b39ebc303",
49-
clientSecret: "4fe39eccbfc586647407ea19f408521f",
48+
clientId: import.meta.env.VITE_AETNA_CLIENT_ID,
5049
note: "VTETestUser01 / FHIRdemo2020"
5150
},
5251
{
53-
id: "c4bb",
54-
name: "CARIN Blue Button",
55-
// url: "https://chpdc-api-sita.carefirst.com/v1/fhir/patientaccess",
52+
id: "carefirst",
53+
name: "CareFirst",
54+
url: "https://chpdc-api-sita.carefirst.com/v1/fhir/patientaccess",
5655
// url: "https://chpmd-api-sita.carefirst.com/v1/fhir/patientaccess",
5756
// url: "https://dsnp-api-sita.carefirst.com/v1/fhir/patientaccess",
5857
// url: "https://mapd-api-sita.carefirst.com/v1/fhir/patientaccess",
5958
// url: "https://mhbe-api-sita.carefirst.com/v1/fhir/patientaccess",
60-
url: "https://egwp-api-sita.carefirst.com/v1/fhir/patientaccess",
61-
clientId: "0oaf5w78xfWspNqeA1d7",
59+
// url: "https://egwp-api-sita.carefirst.com/v1/fhir/patientaccess",
60+
clientId: import.meta.env.VITE_CAREFIRST_CLIENT_ID,
6261
note: "Credentials provided"
6362
},
6463
];

src/lib/sofClient.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@ async function activePatient() {
7676
}
7777

7878
async function getResources() {
79-
client = await FHIR.oauth2.ready();
79+
try {
80+
client = await FHIR.oauth2.ready();
81+
} catch (e) {
82+
throw Error('SMART authorization failed. The service you selected may be unavailable.')
83+
}
8084
let pid = client.getPatientId();
8185
if (!pid) {
8286
console.error("No patient ID found");
83-
return undefined;
87+
throw Error('The service you selected did not return an ID for the authorized patient. Please try a different service.')
8488
}
8589
// Establish resource display methods
8690
let resources;
@@ -94,7 +98,6 @@ async function getResources() {
9498
return requestResources(client, resourceType);
9599
}))).filter(x => x.status == "fulfilled").map(x => x.value);
96100
}
97-
98101

99102
return resources;
100103
}

0 commit comments

Comments
 (0)