-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Aetna and reduce scopes for insurance connection
- Loading branch information
1 parent
44dc926
commit 55ff17c
Showing
4 changed files
with
117 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
export type Bundle = any; | ||
export interface SHLSubmitEvent { | ||
shcs: SHCFile[]; | ||
label?: string; | ||
// content: Bundle; | ||
passcode?: string; | ||
exp?: number; | ||
patientName?: string; | ||
} | ||
|
||
export interface ResourceRetrieveEvent { | ||
resources: Array<any> | undefined; | ||
source?: string | undefined; | ||
} | ||
export interface SHCRetrieveEvent { | ||
shc: SHCFile | undefined; | ||
source?: string | undefined; | ||
} | ||
export interface IPSRetrieveEvent { | ||
ips: Bundle | undefined; | ||
source?: string | undefined; | ||
} | ||
export interface SOFAuthEvent { | ||
data: any | undefined; | ||
} | ||
export interface SHCFile { | ||
verifiableCredential: string[]; | ||
} | ||
|
||
export interface SOFHost { | ||
id:string; | ||
name:string; | ||
url:string; | ||
clientId:string; | ||
clientSecret?: string; | ||
note:string | undefined; | ||
} | ||
|
||
export class ResourceHelper { | ||
tempId: string; | ||
original_resource: any; | ||
simple_resource: any; | ||
resource: any; | ||
include: boolean = true; | ||
|
||
// Constructor | ||
constructor(resource:any) { | ||
this.original_resource = resource; | ||
this.simple_resource = this.simplify(resource); | ||
this.resource = resource; | ||
this.tempId = this.hash(this.simple_resource); | ||
} | ||
|
||
hash(value:any) { | ||
return JSON.stringify(value); | ||
// return crypto.createHash('sha1').update(value).digest('hex'); | ||
} | ||
|
||
simplify(resource:any) { | ||
let simpleResource = JSON.parse(JSON.stringify(resource)); | ||
delete simpleResource.id; | ||
delete simpleResource.meta; | ||
delete simpleResource.text; | ||
// delete simpleResource.patient; | ||
// delete simpleResource.subject; | ||
// delete simpleResource.encounter; | ||
// delete simpleResource.requester; | ||
return this.removeEntries(simpleResource, "reference"); | ||
} | ||
|
||
removeEntries(obj:any, key:string) { | ||
if (typeof obj === "object") { | ||
for (let k in obj) { | ||
if (k === key) { | ||
delete obj[k]; | ||
} else { | ||
obj[k] = this.removeEntries(obj[k], key); | ||
} | ||
} | ||
} else if (obj instanceof Array) { | ||
for (let i=0; i < obj.length; i++) { | ||
obj[i] = this.removeEntries(obj[i], key); | ||
} | ||
} | ||
return obj; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters