diff --git a/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/ProductFieldNameDecorator.java b/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/ProductFieldNameDecorator.java index 3537068..8afc82f 100644 --- a/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/ProductFieldNameDecorator.java +++ b/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/ProductFieldNameDecorator.java @@ -63,6 +63,9 @@ public class ProductFieldNameDecorator implements FieldNameDecorator { m.put("root_productProvenances_productIndications_indication", "Indication"); m.put("root_productManufactureItems_dosageForm", "Dosage Form Name"); + m.put("root_productManufactureItems_dosageFormCode", "Dosage Form Code"); + m.put("root_productManufactureItems_dosageFormCodeType", "Dosage Form Code Type"); + m.put("root_productManufactureItems_routeOfAdministration", "Manufacture Item Route of Administration"); m.put("root_productManufactureItems_charColor", "Manufacture Item Color"); m.put("root_productManufactureItems_charShape", "Manufacture Item Shape"); m.put("root_productManufactureItems_unit", "Manufacture Item Unit"); @@ -74,15 +77,21 @@ public class ProductFieldNameDecorator implements FieldNameDecorator { m.put("root_productManufactureItems_productManufacturers_manufacturedItemCode", "Manufactured Item Code"); m.put("root_productManufactureItems_productManufacturers_manufacturedItemCodeType", "Manufactured Item Code Type"); - m.put("root_productManufactureItems_productLots_productIngredients_applicantIngredName", "Manufacturer Role"); + m.put("root_productManufactureItems_productLots_productIngredients_applicantIngredName", "Applicant Ingredient Name"); m.put("root_productManufactureItems_productLots_productIngredients_substanceKey", "Substance Key"); m.put("root_productManufactureItems_productLots_productIngredients_substanceKeyType", "Substance Key Type"); m.put("root_productManufactureItems_productLots_productIngredients_ingredientType", "Ingredient Type"); m.put("root_productManufactureItems_productLots_productIngredients_ingredientFunction", "Ingredient Function"); m.put("root_productManufactureItems_productLots_productIngredients_ingredientLocation", "Ingredient Location"); + m.put("root_productManufactureItems_productLots_productIngredients_grade", "Ingredient Grade"); + m.put("root_productManufactureItems_productLots_productIngredients_average", "Ingredient Average"); m.put("root_productManufactureItems_productLots_productIngredients_unit", "Ingredient Average Unit"); - m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorUnit", "Original Numerator Unit"); - m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorUnit", "Original Denominator Unit"); + m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorNumber", "Ingredient Original Numerator Number"); + m.put("root_productManufactureItems_productLots_productIngredients_originalNumeratorUnit", "Ingredient Original Numerator Unit"); + m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorNumber", "Ingredient Original Denominator Number"); + m.put("root_productManufactureItems_productLots_productIngredients_originalDenominatorUnit", "Ingredient Original Denominator Unit"); + m.put("root_productManufactureItems_productLots_productIngredients_notes", "Ingredient Notes"); + m.put("root_productManufactureItems_productLots_productIngredients_manufacturer", "Ingredient Manufacturer"); displayNames = m; } diff --git a/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/indexers/ProductSubstanceIndexValueMaker.java b/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/indexers/ProductSubstanceIndexValueMaker.java index c469349..956d205 100644 --- a/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/indexers/ProductSubstanceIndexValueMaker.java +++ b/gsrs-module-products-spring-boot-autoconfigure/src/main/java/gov/hhs/gsrs/products/product/indexers/ProductSubstanceIndexValueMaker.java @@ -49,7 +49,10 @@ public Class getIndexedEntityClass() { @Override public void createIndexableValues(Product product, Consumer consumer) { try { + int numberOfIngredents = 0; + for (ProductManufactureItem prodManuItems : product.productManufactureItems) { + for (ProductLot prodLot : prodManuItems.productLots) { for (ProductIngredient prodIng : prodLot.productIngredients) { @@ -79,16 +82,19 @@ public void createIndexableValues(Product product, Consumer cons // Number of Ingredients in the Product if (prodLot.productIngredients != null) { - String ingredientSize = "0"; if (prodLot.productIngredients.size() > 0) { - ingredientSize = Integer.toString(prodLot.productIngredients.size()); + // Count total number of Ingredients in a product. Since there can be multiple Manufacture Items, + // need to count all the ingredients under each Manufacuture Item record. + numberOfIngredents = numberOfIngredents + prodLot.productIngredients.size(); } - consumer.accept(IndexableValue.simpleFacetStringValue("Number of Ingredients", ingredientSize)); } } // for productLots } // for productManufactureItems + // Create facet "Number of Ingredients" that counts total number of Ingredients in a Product. + String numberOfIngredientsStr = numberOfIngredents > 0 ? Integer.toString(numberOfIngredents) : "0"; + consumer.accept(IndexableValue.simpleFacetStringValue("Number of Ingredients", numberOfIngredientsStr)); // Facet: Application Type Number - Create a facet by combining Application Type and Application Number for (ProductProvenance prodProv : product.productProvenances) {