Skip to content

Commit

Permalink
Merge pull request #280 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 1.6.10
  • Loading branch information
ifoche authored Jul 9, 2024
2 parents 40cb5d5 + 85f1f3b commit a3d49a0
Show file tree
Hide file tree
Showing 33 changed files with 1,387 additions and 493 deletions.
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-06-21T20:57:02.640Z\n"
"PO-Revision-Date: 2024-06-21T20:57:02.640Z\n"
"POT-Creation-Date: 2024-07-06T15:56:43.747Z\n"
"PO-Revision-Date: 2024-07-06T15:56:43.747Z\n"

msgid "Template {{id}} not loaded"
msgstr ""
Expand Down Expand Up @@ -542,6 +542,9 @@ msgstr ""
msgid "Thank you! your data for now is uploaded in our system"
msgstr ""

msgid "Failed to set upload status"
msgstr ""

msgid "Importing data and applying validation rules"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion i18n/es.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"POT-Creation-Date: 2024-06-21T20:57:02.640Z\n"
"POT-Creation-Date: 2024-07-06T15:56:43.747Z\n"
"PO-Revision-Date: 2018-10-25T09:02:35.143Z\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -544,6 +544,9 @@ msgstr ""
msgid "Thank you! your data for now is uploaded in our system"
msgstr ""

msgid "Failed to set upload status"
msgstr ""

msgid "Importing data and applying validation rules"
msgstr ""

Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "glass",
"description": "DHIS2 Glass App",
"version": "1.6.7",
"version": "1.6.10",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"homepage": ".",
Expand Down Expand Up @@ -116,8 +116,10 @@
"script-example": "npx ts-node src/scripts/index.ts example getExample",
"start-amc-recalculate": "npx ts-node src/scripts/cliAMC.ts --debug",
"build-amc-recalculate": "ncc build src/scripts/cliAMC.ts -m -o $npm_package_name-amc-recalculate-server && zip -r $npm_package_name-amc-recalculate-server.zip $npm_package_name-amc-recalculate-server && npx rimraf $npm_package_name-amc-recalculate-server/",
"amr-agg-data-validation": "source .env && ts-node src/scripts/amr_agg_data_validation.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH",
"amr-agg-data-reset": "source .env && ts-node src/scripts/amr_agg_data_reset.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH"
"amr-agg-data-validation-ris": "source .env && npx ts-node src/scripts/amr_agg_data_validation.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH",
"amr-agg-data-reset-ris": "source .env && npx ts-node src/scripts/amr_agg_data_reset.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH",
"amr-agg-data-validation-sample": "source .env && npx ts-node src/scripts/amr_agg_data_validation_sample.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH",
"amr-agg-data-reset-sample": "source .env && npx ts-node src/scripts/amr_agg_data_reset_sample.ts --url $REACT_APP_DHIS2_BASE_URL --auth $REACT_APP_DHIS2_AUTH"
},
"manifest.webapp": {
"name": "glass",
Expand Down
8 changes: 6 additions & 2 deletions src/CompositionRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export function getCompositionRoot(instance: Instance) {
instanceRepository,
programRulesMetadataDefaultRepository,
atcRepository,
amcProductDataRepository
amcProductDataRepository,
amcSubstanceDataRepository
),
validatePrimaryFile: new ValidatePrimaryFileUseCase(
risDataRepository,
Expand Down Expand Up @@ -277,7 +278,10 @@ export function getCompositionRoot(instance: Instance) {
amcProductDataRepository,
glassAtcRepository,
metadataRepository,
glassModuleRepository
glassModuleRepository,
amcSubstanceDataRepository,
glassUploadsRepository,
glassDocumentsRepository
),
consumptionDataSubstanceLevel: new CalculateConsumptionDataSubstanceLevelUseCase(
glassUploadsRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,23 @@ export class AMCSubstanceDataDefaultRepository implements AMCSubstanceDataReposi
});
}

deleteCalculatedSubstanceConsumptionDataById(calculatedConsumptionIds: Id[]): FutureData<TrackerPostResponse> {
const d2EventsCalculatedConsumption: D2TrackerEvent[] = calculatedConsumptionIds.map(eventId => {
return {
event: eventId,
program: "",
status: "COMPLETED",
orgUnit: "",
occurredAt: "",
attributeOptionCombo: "",
dataValues: [],
};
});
return importApiTracker(this.api, { events: d2EventsCalculatedConsumption }, "DELETE").flatMap(response => {
return Future.success(response);
});
}

private mapSubstanceConsumptionCalculatedToD2TrackerEvent(
substanceConsumptionCalculated: SubstanceConsumptionCalculated[],
calculatedConsumptionDataProgram: D2Program | undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Maybe } from "../../../../types/utils";
import { AmName, AwrName, SaltCode, UnitCode } from "../../GlassAtcVersionData";
import {
ATCCodeLevel5,
AmName,
AwrName,
RouteOfAdministrationCode,
SaltCode,
UnitCode,
} from "../../GlassAtcVersionData";
import { Id } from "../../Ref";

export type Content = {
Expand Down Expand Up @@ -43,8 +50,8 @@ export type ContentTonnesPerProduct = {

export type RawSubstanceConsumptionCalculated = {
AMR_GLASS_AMC_TEA_PRODUCT_ID: string;
atc_autocalculated: string;
route_admin_autocalculated: string;
atc_autocalculated: ATCCodeLevel5;
route_admin_autocalculated: RouteOfAdministrationCode;
salt_autocalculated: SaltCode;
year: string;
data_status_autocalculated: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { RouteOfAdministrationCode, SaltCode } from "../../GlassAtcVersionData";
import { ATCCodeLevel5, RouteOfAdministrationCode, SaltCode } from "../../GlassAtcVersionData";
import { Id } from "../../Ref";

export type RawSubstanceConsumptionData = {
id: Id;
atc_manual: string;
atc_manual: ATCCodeLevel5;
route_admin_manual: RouteOfAdministrationCode;
salt_manual: SaltCode;
packages_manual: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Maybe } from "../../../../types/utils";
import { AmName, AwrName, RouteOfAdministrationCode, SaltCode } from "../../GlassAtcVersionData";
import { ATCCodeLevel5, AmName, AwrName, RouteOfAdministrationCode, SaltCode } from "../../GlassAtcVersionData";
import { Id } from "../../Ref";

export type SubstanceConsumptionCalculated = {
atc_autocalculated: string;
atc_autocalculated: ATCCodeLevel5;
route_admin_autocalculated: RouteOfAdministrationCode;
salt_autocalculated: SaltCode;
packages_autocalculated: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export interface AMCSubstanceDataRepository {
orgUnitId: Id,
period: string
): FutureData<SubstanceConsumptionCalculated[] | undefined>;
deleteCalculatedSubstanceConsumptionDataById(calculatedConsumptionIds: Id[]): FutureData<TrackerPostResponse>;
}
13 changes: 9 additions & 4 deletions src/domain/usecases/data-entry/ImportPrimaryFileUseCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ImportAMCProductLevelData } from "./amc/ImportAMCProductLevelData";
import { InstanceDefaultRepository } from "../../../data/repositories/InstanceDefaultRepository";
import { GlassATCDefaultRepository } from "../../../data/repositories/GlassATCDefaultRepository";
import { AMCProductDataRepository } from "../../repositories/data-entry/AMCProductDataRepository";
import { AMCSubstanceDataRepository } from "../../repositories/data-entry/AMCSubstanceDataRepository";

export class ImportPrimaryFileUseCase {
constructor(
Expand All @@ -37,7 +38,8 @@ export class ImportPrimaryFileUseCase {
private instanceRepository: InstanceDefaultRepository,
private programRulesMetadataRepository: ProgramRulesMetadataRepository,
private atcRepository: GlassATCDefaultRepository,
private amcProductRepository: AMCProductDataRepository
private amcProductRepository: AMCProductDataRepository,
private amcSubstanceDataRepository: AMCSubstanceDataRepository
) {}

public execute(
Expand All @@ -50,7 +52,8 @@ export class ImportPrimaryFileUseCase {
orgUnitName: string,
countryCode: string,
dryRun: boolean,
eventListId: string | undefined
eventListId: string | undefined,
calculatedEventListFileId?: string
): FutureData<ImportSummary> {
switch (moduleName) {
case "AMR": {
Expand Down Expand Up @@ -120,7 +123,8 @@ export class ImportPrimaryFileUseCase {
this.metadataRepository,
this.programRulesMetadataRepository,
this.atcRepository,
this.amcProductRepository
this.amcProductRepository,
this.amcSubstanceDataRepository
);

return importAMCProductFile.importAMCProductFile(
Expand All @@ -130,7 +134,8 @@ export class ImportPrimaryFileUseCase {
orgUnitId,
orgUnitName,
moduleName,
period
period,
calculatedEventListFileId
);
}
default: {
Expand Down
Loading

0 comments on commit a3d49a0

Please sign in to comment.