Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Mar 26, 2024
1 parent 44f1185 commit cf3c86f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,40 +64,48 @@ export const getLocationFormFields = (
location?: ILocation,
parentId?: string
): LocationFormFields => {
if(location){
if (location) {
const { position, extension, physicalType, name, status, type } = location;
// TODO - magic string
const geoJsonExtension = getObjLike<Extension>(extension, 'url', locationGeoJsonExtensionUrl)[0] as Extension | undefined;

const geoJsonExtension = getObjLike<Extension>(
extension,
'url',
locationGeoJsonExtensionUrl
)[0] as Extension | undefined;
const geoJsonAttachment = geoJsonExtension?.valueAttachment?.data;
let geometryGeoJSon;
if (geoJsonAttachment) {
// try and parse into an object.
geometryGeoJSon = atob(geoJsonAttachment);
}

const physicalTypeCoding = getObjLike(
physicalType?.coding ?? [],
'system',
physicalTypeValueSetSystem
)[0] as Coding | undefined;

const servicePointTypeCodings = type?.flatMap(concept => concept.coding ?? [])
const serviceTypeCode = getObjLike(servicePointTypeCodings, "system", eusmServicePointCodeSystemUri)?.[0]

const servicePointTypeCodings = type?.flatMap((concept) => concept.coding ?? []);
const serviceTypeCode = getObjLike(
servicePointTypeCodings,
'system',
eusmServicePointCodeSystemUri
)[0] as Coding | undefined;

return {
...defaultFormFields,
initObj: location,
isJurisdiction: physicalTypeCoding?.code !== "bu",
isJurisdiction: physicalTypeCoding?.code !== 'bu',
name,
status,
geometry: geometryGeoJSon,
parentId: parentId ?? location?.partOf?.reference,
parentId: parentId ?? location.partOf?.reference,
latitude: position?.latitude,
longitude: position?.longitude,
serviceType: serviceTypeCode ? JSON.stringify(servicePointTypeCodings) : undefined,
} as LocationFormFields;
}
return defaultFormFields
return defaultFormFields;
};

// TODO - dry out fhir-helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ function parseInventoryGroup(group: IGroup) {
return {
id,
productReference,
quantity: quantityCharacteristic.valueQuantity?.value,
quantity: quantityCharacteristic?.valueQuantity?.value,
poNumber: poNumberIdentifier?.[0]?.value,
deliveryDate: sanitizeDate(startDate),
accountabilityEndDate: sanitizeDate(endDate),
unicefSection: sectionCharacteristic.valueCodeableConcept?.text,
donor: donorCharacteristic.valueCodeableConcept?.text,
unicefSection: sectionCharacteristic?.valueCodeableConcept?.text,
donor: donorCharacteristic?.valueCodeableConcept?.text,
serialNumber: serialNumberIdentifier?.[0]?.value,
};
}
Expand Down

0 comments on commit cf3c86f

Please sign in to comment.