Skip to content

Commit

Permalink
fix: fill epidemics eventName in API instead of pipeline temporarily A…
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Mar 22, 2024
1 parent c5170e0 commit 89d2bcf
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ export class AdminAreaDynamicDataService {
uploadExposure.leadTime,
);

// NOTE: This should be changed in pipeline, but this achieves the same result as long as that did not happen
// NOTE: this assumes eventName=leadTime, if this changes, then this doesn't work any more
if (!uploadExposure.eventName) {
uploadExposure.eventName = this.getEpidemicsEventNameException(
uploadExposure.disasterType,
uploadExposure.leadTime,
);
}

// Delete existing entries in case of a re-run of the pipeline for some reason
await this.deleteDynamicDuplicates(uploadExposure);

Expand Down Expand Up @@ -90,6 +99,19 @@ export class AdminAreaDynamicDataService {
}
}

private getEpidemicsEventNameException(
disasterType: DisasterType,
leadTime: LeadTime,
): string {
if (
disasterType === DisasterType.Dengue ||
disasterType === DisasterType.Malaria
) {
return leadTime as string;
}
return null;
}

private async deleteDynamicDuplicates(
uploadExposure: UploadAdminAreaDynamicDataDto,
): Promise<void> {
Expand Down

0 comments on commit 89d2bcf

Please sign in to comment.