Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko committed May 3, 2024
1 parent 9c783fe commit c471e26
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/workflows/botswana/locationWorkflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,21 @@ export async function translateLocation(location: R4.ILocation): Promise<R4.ILoc
logger.info('Facility mappings: ' + mappings.length)

for (const mapping of mappings) {
if (mapping.orderingFacility == location.name) {
// TODO: Match on system when we decide on MFL system
if(mapping.orderingFacilityMflCode && location.identifier && location.identifier.length > 0 && mapping.orderingFacilityMflCode == location.identifier[0].value) {
logger.info('Matching location by MFL Code')
targetMapping = mapping
} else if (mapping.orderingFacilityName && mapping.orderingFacilityName == location.name) {
logger.warn('MFL Code not found. Falling back to matching location by facility name.')
targetMapping = mapping
} else {
logger.error('Could not find a location mapping for:\n' + JSON.stringify(location.name))
}
}

if (targetMapping) {
logger.info(
"Mapped location '" + location.name + "' to '" + targetMapping.orderingFacility + "'",
)
logger.info(`Mapped location '${location.name}' to '${targetMapping.orderingFacilityMflCode}'|'${targetMapping.orderingFacilityName}'`)

returnLocation.id = crypto
.createHash('md5')
.update('Organization/' + returnLocation.name)
Expand Down

0 comments on commit c471e26

Please sign in to comment.