working on flatiron integration.

correctly converting flatiron patient & group ids to generate API patient id.
This commit is contained in:
Jason Kulatunga 2024-10-08 20:44:29 -04:00
parent 8d28b50c85
commit ea888b1c98
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -155,8 +155,18 @@ export class MedicalSourcesConnectedComponent implements OnInit {
//remove the "Patient/" or "https://example.com/fhir/Patient/" prefix if it exists
payload.patient = payload.patient.split("Patient/")[1]
}
}
//special case for flatiron id token. See https://github.com/fastenhealth/fasten-sources/issues/42
if(!payload.patient && sourceMetadata.platform_type == 'flatiron'){
// "pp.patient_id": "PD_05XXXXXXXXX3",
// "pp.group_id": "GH_CXXXXXXXXXXXX9_5",
// Becomes: PD--05XXXXXXXXX3.GH--CXXXXXXXXXXXX9--5
let decodedAccessToken = this.jwtDecode(payload.access_token)
let patientId = `${decodedAccessToken["pp.patient_id"]}.${decodedAccessToken["pp.group_id"]}`.replace(/_/g, '--')
payload.patient = patientId
}
//get the portal information
const portalInfo = await this.lighthouseApi.getLighthouseCatalogPortal(expectedSourceStateInfo.portal_id)

View File

@ -120,6 +120,8 @@ export class LighthouseService {
}
//DEPRECATED
// TODO: use the fasten-sources js library
async generateSourceAuthorizeUrl(lighthouseSource: LighthouseSourceMetadata, reconnectSourceId?: string): Promise<URL> {
const state = uuidV4()
let sourceStateInfo = new SourceState()