Skip to content

Commit

Permalink
Upload TB Monthly and BUQ demo data (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrochalskisoldevelo authored May 23, 2024
1 parent 1c72643 commit 53bee9f
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 8 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/openlmis/requisition/TestDataInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class TestDataInitializer implements CommandLineRunner {
private static final String STOCK_ADJUSTMENT_REASONS = "stock_adjustment_reasons";
private static final String STOCK_ADJUSTMENTS = "stock_adjustments";
private static final String TEMPLATE_PARAMETERS = "template_parameters";
private static final String REJECTION_REASON_CATEGORIES = "rejection_reason_categories";
private static final String REJECTION_REASONS = "rejection_reasons";

// database path
private static final String DB_SCHEMA = "requisition.";
Expand All @@ -73,6 +75,8 @@ public class TestDataInitializer implements CommandLineRunner {
static final String STOCK_ADJUSTMENT_REASONS_TABLE = DB_SCHEMA + STOCK_ADJUSTMENT_REASONS;
static final String STOCK_ADJUSTMENTS_TABLE = DB_SCHEMA + STOCK_ADJUSTMENTS;
static final String TEMPLATE_PARAMETERS_TABLE = DB_SCHEMA + TEMPLATE_PARAMETERS;
static final String REJECTION_REASON_CATEGORIES_TABLE = DB_SCHEMA + REJECTION_REASON_CATEGORIES;
static final String REJECTION_REASONS_TABLE = DB_SCHEMA + REJECTION_REASONS;

@Value(value = DEMO_DATA_PATH + DB_SCHEMA + COLUMNS_MAPS + FILE_EXTENSION)
private Resource columnsMapsResource;
Expand Down Expand Up @@ -114,6 +118,12 @@ public class TestDataInitializer implements CommandLineRunner {
@Value(value = DEMO_DATA_PATH + DB_SCHEMA + TEMPLATE_PARAMETERS + FILE_EXTENSION)
private Resource templateParametersResource;

@Value(value = DEMO_DATA_PATH + DB_SCHEMA + REJECTION_REASON_CATEGORIES + FILE_EXTENSION)
private Resource rejectionReasonCategoriesResource;

@Value(value = DEMO_DATA_PATH + DB_SCHEMA + REJECTION_REASONS + FILE_EXTENSION)
private Resource rejectionReasonsResource;

@Value(value = DB_MIGRATION_PATH
+ "20170822230153657__generate_requisition_permission_strings.sql")
private Resource generateRequisitionPermissionStringsResource;
Expand Down Expand Up @@ -154,6 +164,9 @@ public void run(String... args) throws IOException {

loader.insertToDbFromCsv(JASPER_TEMPLATES_TABLE, jasperTemplatesResource);
loader.insertToDbFromCsv(TEMPLATE_PARAMETERS_TABLE, templateParametersResource);
loader.insertToDbFromCsv(
REJECTION_REASON_CATEGORIES_TABLE, rejectionReasonCategoriesResource);
loader.insertToDbFromCsv(REJECTION_REASONS_TABLE, rejectionReasonsResource);
loader.insertToDbFromCsv(
JASPER_TEMPLATE_PARAMETER_DEPENDENCIES_TABLE, jasperTemplateParameterDependenciesResource);

Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/db/demo-data/requisition.columns_maps.csv
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,33 @@ requisitionTemplateId,key,name,label,indicator,displayOrder,isDisplayed,source,d
14e756d2-60a6-45fd-b135-3caff3f328cd,totalQuantityNeededByHf,totalQuantityNeededByHf,Total Quantity Needed by HF (F) F = E * 2,TF,10,false,1,Total quantity of product needed by Health Facility.,d58e83a3-78ee-4657-b3d9-7b1adc983837,,
14e756d2-60a6-45fd-b135-3caff3f328cd,quantityToIssue,quantityToIssue,Quantity to issue (G) G = F - A,TG,11,false,1,Number of products to be issued.,421cd415-f127-4683-a396-a10a7bfdc384,,
14e756d2-60a6-45fd-b135-3caff3f328cd,convertedQuantityToIssue,convertedQuantityToIssue,Quantity to issue (converted to unit of measure) G/U,TH,12,false,1,Quantity to issue expressed in the units in which it is measured.,d173872d-f5e7-48a2-b0a7-c7fcae4208d4,,
913f566e-a94d-467e-9309-f13db7685ff8,skipped,skipped,Skip,S,1,true,0,Select the check box below to skip a single product. Remove all data from the row prior to selection.,c6dffdee-3813-40d9-8737-f531d5adf420,17d6e860-a746-4500-a0fa-afc84d799dca,
913f566e-a94d-467e-9309-f13db7685ff8,orderable.productCode,orderable.productCode,Product code,O,2,true,2,Unique identifier for each commodity/product.,bde01507-3837-47b7-ae08-cec92c0c3cd2,,
913f566e-a94d-467e-9309-f13db7685ff8,orderable.fullProductName,orderable.fullProductName,Product,R,3,true,2,Primary name of the product.,e53e80de-fc63-4ecb-b6b2-ef376b34c926,,
913f566e-a94d-467e-9309-f13db7685ff8,beginningBalance,beginningBalance,Beginning balance,A,15,false,0,Based on the Stock On Hand from the previous period. This is quantified in dispensing units.,33b2d2e9-3167-46b0-95d4-1295be9afc22,,
913f566e-a94d-467e-9309-f13db7685ff8,totalReceivedQuantity,totalReceivedQuantity,Quantity Issued ,B,6,true,0,Quantity Issued.,5ba8b72d-277a-4da8-b10a-23f0cda23cb4,,
913f566e-a94d-467e-9309-f13db7685ff8,totalConsumedQuantity,totalConsumedQuantity,Total consumed quantity,C,16,false,0,Quantity dispensed/consumed in the reporting period. This is quantified in dispensing units.,9e825396-269d-4873-baa4-89054e2722f4,,
913f566e-a94d-467e-9309-f13db7685ff8,totalLossesAndAdjustments,totalLossesAndAdjustments,Loss & Adjustments (B) ,D,7,true,0,All kind of losses/adjustments made at the facility.,cd57f329-f549-4717-882e-ecbf98122c38,,
913f566e-a94d-467e-9309-f13db7685ff8,totalStockoutDays,totalStockoutDays,Total stockout days,X,17,false,0,Total number of days facility was out of stock.,750b9359-c097-4612-8328-d21671f88920,,
913f566e-a94d-467e-9309-f13db7685ff8,stockOnHand,stockOnHand,Stock on hand (A) ,E,4,true,1,Current physical count of stock on hand. This is quantified in dispensing units.,752cda76-0db5-4b6e-bb79-0f531ab78e2c,,
913f566e-a94d-467e-9309-f13db7685ff8,averageConsumption,averageConsumption,Average consumption,P,18,false,1,Average consumption over a specified number of periods/months. Quantified in dispensing units.,89113ec3-40e9-4d81-9516-b56adba7f8cd,,
913f566e-a94d-467e-9309-f13db7685ff8,calculatedOrderQuantity,calculatedOrderQuantity,Calculated order quantity,I,19,false,1,Actual quantity needed after deducting stock in hand. This is quantified in dispensing units.,5528576b-b1e7-48d9-bf32-fd0eefefaa9a,,
913f566e-a94d-467e-9309-f13db7685ff8,pricePerPack,pricePerPack,Price per pack,T,20,false,2,Price per pack. Will be blank if price is not defined.,df524868-9d0a-18e6-80f5-76304ded7ab9,,
913f566e-a94d-467e-9309-f13db7685ff8,packsToShip,packsToShip,Packs to ship,V,21,false,1,Total packs to be shipped based on pack size and applying rounding rules.,dc9dde56-593d-4929-81be-d1faec7025a8,dcf41f06-3000-4af6-acf5-5de4fffc966f,
913f566e-a94d-467e-9309-f13db7685ff8,orderable.dispensable.displayUnit,orderable.dispensable.displayUnit,Unit of measure (U) ,U,8,true,2,Display unit for this product.,61e6d059-10ef-40c4-a6e3-fa7b9ad741ec,,
913f566e-a94d-467e-9309-f13db7685ff8,requestedQuantity,requestedQuantity,Requested quantity,J,22,false,0,Requested override of calculated quantity. This is quantified in dispensing units.,4a2e9fd3-1127-4b68-9912-84a5c00f6999,,
913f566e-a94d-467e-9309-f13db7685ff8,requestedQuantityExplanation,requestedQuantityExplanation,Requested quantity explanation,W,23,false,0,Explanation of request for a quantity other than calculated order quantity.,6b8d331b-a0dd-4a1f-aafb-40e6a72ab9f5,,
913f566e-a94d-467e-9309-f13db7685ff8,approvedQuantity,approvedQuantity,Approved quantity,K,24,false,0,Final approved quantity. This is quantified in dispensing units.,a62a5fed-c0b6-4d49-8a96-c631da0d0113,,
913f566e-a94d-467e-9309-f13db7685ff8,remarks,remarks,Remarks,L,5,true,0,Any additional remarks.,2ed8c74a-f424-4742-bd14-cfbe67b6e7be,,
913f566e-a94d-467e-9309-f13db7685ff8,total,total,Total,Y,25,false,1,Total of beginning balance and quantity received.,ef524868-9d0a-11e6-80f5-76304dec7eb7,,
913f566e-a94d-467e-9309-f13db7685ff8,numberOfNewPatientsAdded,numberOfNewPatientsAdded,Number of new patients added,F,26,false,0,New patients data.,5708ebf9-9317-4420-85aa-71b2ae92643d,34b8e763-71a0-41f1-86b4-1829963f0704,
913f566e-a94d-467e-9309-f13db7685ff8,totalCost,totalCost,Total cost,Q,27,false,1,Total cost of the product based on quantity requested. Will be blank if price is not defined.,e3a0c1fc-c2d5-11e6-af2d-3417eb83144e,,
913f566e-a94d-467e-9309-f13db7685ff8,adjustedConsumption,adjustedConsumption,Adjusted consumption,N,28,false,1,Total consumed quantity after adjusting for stockout days. Quantified in dispensing units.,720dd95b-b765-4afb-b7f2-7b22261c32f3,,
913f566e-a94d-467e-9309-f13db7685ff8,maximumStockQuantity,maximumStockQuantity,Maximum stock quantity,H,29,false,1,Maximum stock calculated based on consumption and max stock amounts. Quantified in dispensing units.,913e1a4f-f3b0-40c6-a422-2f73608c6f3d,ff2b350c-37f2-4801-b21e-27ca12c12b3c,
913f566e-a94d-467e-9309-f13db7685ff8,additionalQuantityRequired,additionalQuantityRequired,Additional quantity required,Z,30,false,0,Additional quantity required for new patients,90a84767-1009-4d8e-be13-f006fce2a002,,
913f566e-a94d-467e-9309-f13db7685ff8,numberOfPatientsOnTreatmentNextMonth,numberOfPatientsOnTreatmentNextMonth,No of Patients on Treatment next month (C),TC,9,true,1,The number of patients who will be treated in the next month.,ef7c65c6-1be3-410b-9a2e-8b9f68221e82,,
913f566e-a94d-467e-9309-f13db7685ff8,dosesPerPatient,dosesPerPatient,Individual Monthly Requirement (D),TD,10,true,2,The amount of product for single patient.,3efdf855-cc03-4ccc-97f2-60108bc4b7a3,,
913f566e-a94d-467e-9309-f13db7685ff8,totalRequirement,totalRequirement,Total Requirement (E) E = C * D,TE,11,true,1,Product requirement for all patients.,7563a92f-2c07-4b09-a88e-d0faa0baee93,,
913f566e-a94d-467e-9309-f13db7685ff8,totalQuantityNeededByHf,totalQuantityNeededByHf,Total Quantity Needed by HF (F) F = E * 2,TF,12,true,1,Total quantity of product needed by Health Facility.,d58e83a3-78ee-4657-b3d9-7b1adc983837,,
913f566e-a94d-467e-9309-f13db7685ff8,quantityToIssue,quantityToIssue,Quantity to issue (G) G = F - A,TG,13,true,1,Number of products to be issued.,421cd415-f127-4683-a396-a10a7bfdc384,,
913f566e-a94d-467e-9309-f13db7685ff8,convertedQuantityToIssue,convertedQuantityToIssue,Quantity to issue (converted to unit of measure) G/U,TH,14,true,1,Quantity to issue expressed in the units in which it is measured.,d173872d-f5e7-48a2-b0a7-c7fcae4208d4,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,active,name,code
ff636054-6812-441e-bc28-62a5e018aadb,true,BUQ,BUQ
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,active,name,code,rejectionreasoncategoryid
6324afcd-7dc9-4660-be34-e2c5c7d4cdc3,true,incorrect form,BUQ,ff636054-6812-441e-bc28-62a5e018aadb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ ef52d3b0-4e41-4eee-95d0-22d7a9c7d43a,418bdc1d-c303-4bd0-b2d3-d8901150a983,5fc213
7d846456-a768-4310-b660-1aefb87fb903,418bdc1d-c303-4bd0-b2d3-d8901150a983,caecea08-6b2f-4ba9-98b2-b87702ba57ba,6c4b004b-b7c9-46f0-bb1b-bd128d36729f
c500d247-a8ab-4321-a170-08bf0b7278f0,418bdc1d-c303-4bd0-b2d3-d8901150a983,ac1d268b-ce10-455f-bf87-9c667da8f060,37f29736-f0db-4de3-98ad-f8d85c848711
d8a5f3fd-719c-4187-91b3-4c5a2dd76c90,ef9a2b39-e7ce-4ebe-930c-f5c6d15b578a,ac1d268b-ce10-455f-bf87-9c667da8f060,6fa1a58c-960b-4835-be22-05be5f7357e2
b1d8dbc2-844e-4ff1-821f-bdf8d6cbb933,8a0cf9c6-0591-4ce1-bbbb-ae55553db0dc,ac1d268b-ce10-455f-bf87-9c667da8f060,14e756d2-60a6-45fd-b135-3caff3f328cd
b1d8dbc2-844e-4ff1-821f-bdf8d6cbb933,8a0cf9c6-0591-4ce1-bbbb-ae55553db0dc,ac1d268b-ce10-455f-bf87-9c667da8f060,14e756d2-60a6-45fd-b135-3caff3f328cd
bd5921fa-c6a1-4c5e-b286-007c10a9c69e,5a666ff8-5d87-477e-8109-42f6ac666eb1,ac1d268b-ce10-455f-bf87-9c667da8f060,913f566e-a94d-467e-9309-f13db7685ff8
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
id,createdDate,numberOfPeriodsToAverage,populateStockOnHandFromStockCards,name,archived
5a268780-fafd-4243-9551-5c7daa824913,2016-06-14T12:00:00,3,false,Family Planning,false
4b30f6c9-b84b-4f17-8173-852101a5ea29,2016-03-17T12:00:00,3,false,Essential Meds,false
6c4b004b-b7c9-46f0-bb1b-bd128d36729f,2016-06-14T12:00:00,3,true,EPI,false
37f29736-f0db-4de3-98ad-f8d85c848711,2018-02-13T07:00:00,3,true,Vaccine Stock-Based R&R Template,false
6fa1a58c-960b-4835-be22-05be5f7357e2,2018-10-26T16:00:00,3,false,CHAZ,false
14e756d2-60a6-45fd-b135-3caff3f328cd,2020-01-01T00:00:00,3,false,Lab program,false
id,createdDate,numberOfPeriodsToAverage,populateStockOnHandFromStockCards,name,archived,patientsTabEnabled
5a268780-fafd-4243-9551-5c7daa824913,2016-06-14T12:00:00,3,false,Family Planning,false,false
4b30f6c9-b84b-4f17-8173-852101a5ea29,2016-03-17T12:00:00,3,false,Essential Meds,false,false
6c4b004b-b7c9-46f0-bb1b-bd128d36729f,2016-06-14T12:00:00,3,true,EPI,false,false
37f29736-f0db-4de3-98ad-f8d85c848711,2018-02-13T07:00:00,3,true,Vaccine Stock-Based R&R Template,false,false
6fa1a58c-960b-4835-be22-05be5f7357e2,2018-10-26T16:00:00,3,false,CHAZ,false,false
14e756d2-60a6-45fd-b135-3caff3f328cd,2020-01-01T00:00:00,3,false,Lab program,false,false
913f566e-a94d-467e-9309-f13db7685ff8,2016-06-14T12:00:00,3,false,TB Monthly,false,true
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import static org.openlmis.requisition.TestDataInitializer.JASPER_TEMPLATES_TABLE;
import static org.openlmis.requisition.TestDataInitializer.JASPER_TEMPLATE_PARAMETER_DEPENDENCIES_TABLE;
import static org.openlmis.requisition.TestDataInitializer.PREVIOUS_ADJUSTED_CONSUMPTIONS_TABLE;
import static org.openlmis.requisition.TestDataInitializer.REJECTION_REASONS_TABLE;
import static org.openlmis.requisition.TestDataInitializer.REJECTION_REASON_CATEGORIES_TABLE;
import static org.openlmis.requisition.TestDataInitializer.REQUISITIONS_TABLE;
import static org.openlmis.requisition.TestDataInitializer.REQUISITION_LINE_ITEMS_TABLE;
import static org.openlmis.requisition.TestDataInitializer.REQUISITION_TEMPLATES_TABLE;
Expand Down Expand Up @@ -82,6 +84,12 @@ public class TestDataInitializerTest {
@Mock
private Resource templateParametersResource;

@Mock
private Resource rejectionReasonCategoriesResource;

@Mock
private Resource rejectionReasonsResource;

@Mock
private Resource generateRequisitionPermissionStringsResource;

Expand Down Expand Up @@ -115,6 +123,9 @@ public void shouldLoadData() throws IOException {
.insertToDbFromCsv(STOCK_ADJUSTMENT_REASONS_TABLE, stockAdjustmentReasonsResource);
verify(loader).insertToDbFromCsv(STOCK_ADJUSTMENTS_TABLE, stockAdjustmentsResource);
verify(loader).insertToDbFromCsv(TEMPLATE_PARAMETERS_TABLE, templateParametersResource);
verify(loader).insertToDbFromCsv(
REJECTION_REASON_CATEGORIES_TABLE, rejectionReasonCategoriesResource);
verify(loader).insertToDbFromCsv(REJECTION_REASONS_TABLE, rejectionReasonsResource);

verify(template).update("DELETE FROM requisition.requisition_permission_strings;");
verify(loader).updateDbFromSqlSingle(generateRequisitionPermissionStringsResource);
Expand Down

0 comments on commit 53bee9f

Please sign in to comment.