Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renamed the field name #30

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
import gsrs.service.EtagExportGenerator;
import gsrs.service.ExportService;
import gsrs.service.GsrsEntityService;
import gsrs.GsrsFactoryConfiguration;
import gsrs.controller.hateoas.HttpRequestHolder;
import ix.core.models.Principal;
import ix.core.models.ETag;
import ix.core.search.text.TextIndexer;
import ix.core.search.SearchResult;
import ix.core.search.SearchOptions;
import ix.ginas.exporters.ExportMetaData;
import ix.ginas.exporters.ExportProcess;
import ix.ginas.exporters.Exporter;
Expand Down Expand Up @@ -83,6 +86,9 @@ public class ProductController extends EtagLegacySearchEntityController<ProductC
@Autowired
private ObjectMapper objectMapper;

@Autowired
private GsrsFactoryConfiguration gsrsFactoryConfiguration;


@Override
public GsrsEntityService<Product, Long> getEntityService() {
Expand All @@ -99,6 +105,29 @@ protected Stream<Product> filterStream(Stream<Product> stream, boolean publicOnl
return stream;
}

@Override
public SearchOptions instrumentSearchOptions(SearchOptions so) {

so= super.instrumentSearchOptions(so);
so.addDateRangeFacet("root_lastModifiedDate");
so.addDateRangeFacet("root_creationDate");

if (gsrsFactoryConfiguration != null) {
Optional<Map<String, Object>> conf = gsrsFactoryConfiguration
.getSearchSettingsFor(ProductEntityService.CONTEXT);

String restrict = conf
.map(cc -> cc.get("restrictDefaultToIdentifiers"))
.filter(bb -> bb != null).map(bb -> bb.toString())
.orElse(null);
if (restrict != null && "true".equalsIgnoreCase(restrict)) {
so.setDefaultField(TextIndexer.FULL_IDENTIFIER_FIELD);
}
}

return so;
}

@GetGsrsRestApiMapping("/distinctprovenance/{substanceId}")
public ResponseEntity<String> findProvenanceBySubstance(@PathVariable("substanceId") String substanceId) throws Exception {
List<String> provenanceList = productEntityService.findProvenanceBySubstance(substanceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void createIndexableValues(Product product, Consumer<IndexableValue> cons

// Get from Config which Substance Key Resolver to use. Substance API or Entity Mananger
if (substanceKeyResolverToUseFromConfig != null) {

if (substanceKeyResolverToUseFromConfig.equalsIgnoreCase("api")) {
// Call SUBSTANCE API Substance Resolver
createIndexableValuesBySubstanceApiResolver(consumer, substanceKey, substanceKeyType);
Expand All @@ -75,6 +76,16 @@ public void createIndexableValues(Product product, Consumer<IndexableValue> cons
} // product substance key not null
} // product Ingredient is not null
} // for productIngredients

// Number of Ingredients in the Product
if (prodLot.productIngredients != null) {
String ingredientSize = "0";
if (prodLot.productIngredients.size() > 0) {
ingredientSize = Integer.toString(prodLot.productIngredients.size());
}
consumer.accept(IndexableValue.simpleFacetStringValue("Number of Ingredients", ingredientSize));
}

} // for productLots
} // for productManufactureItems

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public class Product extends ProductCommonData {
@Column(name="PRODUCT_ID")
public Long id;

@Column(name="PHARMACEDICAL_DOSAGE_FORM", length=500)
public String pharmacedicalDosageForm;
@Indexable(suggest = true, facet=true, name="Product Container")
@Column(name="PRODUCT_CONTAINER", length=500)
public String productContainer;

@Indexable(suggest = true, facet=true, name="Route of Administration")
@Column(name="ROUTE_OF_ADMINISTRATION")
Expand All @@ -52,6 +53,7 @@ public class Product extends ProductCommonData {
@Column(name="COUNTRY_CODE", length=500)
public String countryCode;

@Indexable(facet=true, name="Language")
@Column(name="LANGUAGE")
public String language;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ProductIngredient extends ProductCommonData {
@Column(name = "SUBSTANCE_KEY_TYPE")
public String substanceKeyType;

@Indexable
@Indexable(facet = true, name = "Basis of Strength Substance Key")
@Column(name = "BOS_SUBSTANCE_KEY")
public String basisOfStrengthSubstanceKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class ProductName extends ProductCommonData {
@Column(name="PRODUCT_NAME", length=1000)
public String productName;

@Indexable(suggest = true, facet=true, name= "Product Name Type", sortable = true)
@Column(name="PRODUCT_NAME_TYPE")
public String productNameType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class ProductProvenance extends ProductCommonData {
@Column(name="JURISDICTIONS", length=500)
public String jurisdictions;

@Indexable(suggest = true, facet=true, name="Marketing Category Code")
@Column(name="MARKETING_CATEGORY_CODE")
public String marketingCategoryCode;

Expand All @@ -94,7 +95,7 @@ public class ProductProvenance extends ProductCommonData {
@Column(name="CONTROL_SUBSTANCE_SOURCE", length=500)
public String controlSubstanceSource;

@Column(name = "PRODUCT_URL", length=500)
@Column(name="PRODUCT_URL", length=500)
public String productUrl;

// Set Parent Class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,37 +478,6 @@ gsrs.indexers.list=[
}
]

# Example report. Change the SQL and path to suit your needs
#gsrs.scheduled-tasks.list+=
# {
# "scheduledTaskClass" : "gsrs.module.substance.tasks.SQLReportScheduledTaskInitializer",
# "parameters" : {
# "autorun": true,
# "sql": "select s.uuid, dtype, s.current_version, s.created, c.code, c.code_system from ix_ginas_substance s, ix_ginas_code c where s.uuid = c.owner_uuid and c.type= 'PRIMARY'",
# "outputPath": "test_code_report_%DATE%_%TIME%.txt",
# "name": "Simple Code Report",
# "cron":"0 0/1 * * * ?", #every 1 mins
### Datasource qualifier can be specified if needed. This is typically of the form:
### "<resource>DataSource". For example, "defaultDataSource" or "productsDataSource"/
### "dataSourceQualifier":"defaultDataSource",
# }
# }

# Example SPL report. Change the SPL settings to suit your needs
#gsrs.scheduled-tasks.list+=
# {
# "scheduledTaskClass" : "gsrs.module.substance.tasks.SplExportInitializer",
# "parameters" : {
# "autorun": true,
# "username":"admin",
## You can set up an explicit export directory, but don't need to
## "outputPath": "tmpspl",
# "name": "SPL export",
# "cron":"0 0/10 * * * ?" #every 1 mins
# }
# }


gsrs.validators.substances += {
"validatorClass" = "ix.ginas.utils.validation.validators.SetReferenceAccess",
"newObjClass" = "ix.ginas.models.v1.Substance",
Expand Down Expand Up @@ -565,12 +534,4 @@ ix.ginas.export.settingsPresets.products= {
}
}

# Export CONFIG
#ix.ginas.export.settingsPresets.productsall= {
# "ALL_DATA": {
# "owner":"admin",
# "scrubberSettings":null
# }
#}

##******* PRODUCT CONFIG END ********************
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class ProductDTO {

private Long id;
private String pharmacedicalDosageForm;
private String productContainer;
private String routeAdmin;
private String unitPresentation;
private String countryCode;
Expand All @@ -30,6 +30,8 @@ public class ProductDTO {
private String manufacturerName;
private String manufacturerCode;
private String manufacturerCodeType;
private Date effectiveDate;
private Date endDate;

private final List<ProductProvenanceDTO> productProvenances = new ArrayList();
private final List<ProductManufactureItemDTO> productManufactureItems = new ArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public class ProductIngredientDTO {
private String releaseCharacteristic;
private String notes;
private String grade;
private String ingredientFunction;
private String ingredientLocation;
private String ingredientLocationText;
private String confidentialityCode;
private String originalNumeratorNumber;
private String originalNumeratorUnit;
Expand Down
Loading