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

DO NOT merge! Broken tests #381

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 19 additions & 7 deletions gsrs-module-substance-example/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,41 @@ ix.authentication.logheaders=false
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.gsrs.module.substance.scrubbers.basic=trace

gsrs.matchableCalculators.substances =
[
gsrs.matchableCalculators.substances.list.CASNumberMatchableExtractor =

{"matchableCalculationClass" : "gsrs.dataexchange.extractors.CASNumberMatchableExtractor",
"config" :{
"casCodeSystems": ["CAS", "CASNo", "CASNumber"]
}
},
}

gsrs.matchableCalculators.substances.list.AllNamesMatchableExtractor=
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.AllNamesMatchableExtractor","config" :{}},

gsrs.matchableCalculators.substances.list.ApprovalIdMatchableExtractor=
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.ApprovalIdMatchableExtractor","config" :{}},
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.DefinitionalHashMatchableExtractor","config" :{}},

gsrs.matchableCalculators.substances.list.DefinitionalHashMatchableExtractor=
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.DefinitionalHashMatchableExtractor","config" :{}}

gsrs.matchableCalculators.substances.list.SelectedCodesMatchableExtractor=
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.SelectedCodesMatchableExtractor",
"config" :
{
"codeSystems" :["CAS", "ChemBL", "NCI", "NSC", "EINECS"]
}
},
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.UUIDMatchableExtractor","config" :{}},
}

gsrs.matchableCalculators.substances.list.UUIDMatchableExtractor=
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.UUIDMatchableExtractor","config" :{}}

gsrs.matchableCalculators.substances.list.CodeMatchableExtractor =
{"matchableCalculationClass" : "gsrs.dataexchange.extractors.CodeMatchableExtractor",
"config" :{
"reqCodeSystems": ["FDA UNII"],
"codeType": "PRIMARY",
"codeKey": "CODE"
}
}
]


40 changes: 25 additions & 15 deletions gsrs-module-substance-example/src/main/resources/fda-extension.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ gsrs.microservice.clinicaltrialseurope.api.headers= {
"auth-key"="myKey"
}

gsrs.entityProcessors +={
gsrs.entityProcessors.list.UniqueCodeGenerator =
{
"entityClassName" = "ix.ginas.models.v1.Substance",
"processor" = "gsrs.module.substance.processors.UniqueCodeGenerator",
"order" = 8010,
"with"= {
"useLegacy"=true,
"codesystem"="BDNUM",
Expand All @@ -39,16 +41,27 @@ gsrs.entityProcessors +={
}
}

gsrs.entityProcessors +=
{
"entityClassName" = "ix.ginas.models.v1.Substance",
"processor" = "gsrs.module.substance.processors.ApprovalIdProcessor",
"parameters" = {
"codeSystem" = "FDA UNII"
}
gsrs.entityProcessors.list.ApprovalIdProcessor =
{
"entityClassName" = "ix.ginas.models.v1.Substance",
"processor" = "gsrs.module.substance.processors.ApprovalIdProcessor",
"order" = 6010
}

ix.ginas.export.factories.substances = ${ix.ginas.export.factories.substances}[


#gsrs.entityProcessors.ApprovalIdProcessor=
# {
# "order":124,
# "entityClassName": "ix.ginas.models.v1.Substance",
# "processor" = "gsrs.module.substance.processors.ApprovalIdProcessor",
# "parameters" = {
# "codeSystem" = "FDA UNII"
# }
# }

#removed ${ix.ginas.export.factories.substances}
ix.ginas.export.factories.substances =[
#"gsrs.module.substance.ExtraColumnsSpreadsheetExporterFactory",

"fda.gsrs.substance.exporters.FDANameExporterFactory",
Expand All @@ -62,11 +75,8 @@ ix.ginas.export.factories.substances = ${ix.ginas.export.factories.substances}[

ix.ginas.approvalIdGenerator.generatorClass=ix.ginas.utils.UNIIGenerator


gsrs.validators.substances += {

gsrs.validators.substances.list.BdNumModificationValidator= {
"validatorClass" = "fda.gsrs.substance.validators.BdNumModificationValidator",
"newObjClass" = "ix.ginas.models.v1.Substance"
"newObjClass" = "ix.ginas.models.v1.Substance",
"order"=4000
}


Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ public void testSetup() throws IllegalAccessException, NoSuchFieldException, Jso
String substanceContext = "substances";
//build up a complete configuration
GsrsFactoryConfiguration config = new GsrsFactoryConfiguration();
Map<String, List<Map<String, Object>>> adapterConfig = new HashMap<>();
Map<String, Map<String, Map<String, Object>>> adapterConfig = new HashMap<>();
Map<String, Object> oneAdapter = new HashMap<>();
oneAdapter.put("importAdapterFactoryClass", "gsrs.module.substance.importers.SDFImportAdapterFactory");
oneAdapter.put("adapterName", "NSRS SDF Adapter");
oneAdapter.put("extensions", Arrays.asList("sdf", "sd"));
oneAdapter.put("parameters", buildConfigParameters());
oneAdapter.put("stagingAreaServiceClass", gsrs.stagingarea.service.DefaultStagingAreaService.class);
oneAdapter.put("entityServiceClass", "gsrs.dataexchange.SubstanceStagingAreaEntityService");
List<Map<String, Object>> adapters = new ArrayList<>();
adapters.add(oneAdapter);
Map<String,Map<String, Object>> adapters = new HashMap<>();
adapters.put("NSRS SDF Adapter", oneAdapter);
adapterConfig.put(substanceContext, adapters);
config.setImportAdapterFactories(adapterConfig);
Map<String, Map<String, Map<String, Map<String, Object>>>> higherLevelMap = new HashMap<>();
higherLevelMap.put("imports", adapterConfig);
config.setImportAdapterFactories(higherLevelMap);
ConfigBasedGsrsImportAdapterFactoryFactory factoryFactory = new ConfigBasedGsrsImportAdapterFactoryFactory();
Field configField = factoryFactory.getClass().getDeclaredField("gsrsFactoryConfiguration"); //gsrs.imports.ConfigBasedGsrsImportAdapterFactoryFactory.
configField.setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,43 @@ public void setup() throws NoSuchFieldException, IllegalAccessException {
log.trace("setting up staging area service");
stagingAreaService = new DefaultStagingAreaService();
stagingAreaService = AutowireHelper.getInstance().autowireAndProxy(stagingAreaService);
Map<String, List<Map<String, Object>>> matchableCalculatorConfig = new HashMap<>();
List<Map<String, Object>> configs = new ArrayList<>();
Map<String, Map<String, Map<String, Object>>> matchableCalculatorConfig = new HashMap<>();
Map<String, Map<String, Object>> configs = new HashMap<>();
Map<String, Object> casExtractor = new HashMap<>();
casExtractor.put("matchableCalculationClass", CASNumberMatchableExtractor.class);
LinkedHashMap<String, Object> config= new LinkedHashMap<>();
config.put("casCodeSystems", Arrays.asList("CAS", "CASNo", "CASNumber"));
casExtractor.put("config", config);
configs.add(casExtractor);
configs.put("CASNumberMatchableExtractor", casExtractor);

Map<String, Object> namesExtractor = new HashMap<>();
namesExtractor.put("matchableCalculationClass", AllNamesMatchableExtractor.class);
configs.add(namesExtractor);
configs.put("AllNamesMatchableExtractor", namesExtractor);

Map<String, Object> defHashExtractor = new HashMap<>();
defHashExtractor.put("matchableCalculationClass", DefinitionalHashMatchableExtractor.class);
configs.add(defHashExtractor);
configs.put("DefinitionalHashMatchableExtractor", defHashExtractor);

Map<String, Object> selectedCodesExtractor = new HashMap<>();
selectedCodesExtractor.put("matchableCalculationClass", SelectedCodesMatchableExtractor.class);
LinkedHashMap<String, Object> config2= new LinkedHashMap<>();
config2.put("codeSystems", Arrays.asList("CAS", "ChemBL", "NCI", "NSC", "EINECS"));
selectedCodesExtractor.put("config", config2);
configs.add(selectedCodesExtractor);
configs.put("SelectedCodesMatchableExtractor", selectedCodesExtractor);

Map<String, Object> uuidExtractor = new HashMap<>();
uuidExtractor.put("matchableCalculationClass", UUIDMatchableExtractor.class);
configs.add(uuidExtractor);
configs.put("UUIDMatchableExtractor", uuidExtractor);
matchableCalculatorConfig.put("substances", configs);

SubstanceStagingAreaEntityService stagingAreaEntityService = new SubstanceStagingAreaEntityService();
stagingAreaEntityService = AutowireHelper.getInstance().autowireAndProxy(stagingAreaEntityService);
Field factoryConfigField= stagingAreaEntityService.getClass().getDeclaredField("gsrsFactoryConfiguration");
factoryConfigField.setAccessible(true);
GsrsFactoryConfiguration factoryConfiguration= (GsrsFactoryConfiguration) factoryConfigField.get(stagingAreaEntityService);
factoryConfiguration.setMatchableCalculators(matchableCalculatorConfig);
Map<String,Map<String, Map<String,Map<String, Object>>>> oneUp = new HashMap<>();
oneUp.put("matchableCalculatorConfig", matchableCalculatorConfig);
factoryConfiguration.setMatchableCalculators(oneUp);
stagingAreaService.registerEntityService(stagingAreaEntityService);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ gsrs.standardizers.substances = {
}
}

gsrs.importAdapterFactories.substances =
[
gsrs.importAdapterFactories.substances.list.SDFImportAdapterFactory =
{

"adapterName": "SDF Adapter",
"order" : 10,
"importAdapterFactoryClass": "gsrs.module.substance.importers.SDFImportAdapterFactory",
"stagingAreaServiceClass": "gsrs.stagingarea.service.DefaultStagingAreaService",
"entityServiceClass" :"gsrs.dataexchange.SubstanceStagingAreaEntityService",
Expand Down Expand Up @@ -303,9 +302,11 @@ gsrs.importAdapterFactories.substances =
}
]
}
},
{
}

gsrs.importAdapterFactories.substances.list.DelimTextImportAdapterFactory ={
"adapterName": "Delimited Text Adapter",
"order" : 40,
"importAdapterFactoryClass": "gsrs.module.substance.importers.DelimTextImportAdapterFactory",
"stagingAreaServiceClass": "gsrs.stagingarea.service.DefaultStagingAreaService",
"entityServiceClass" :"gsrs.dataexchange.SubstanceStagingAreaEntityService",
Expand Down Expand Up @@ -436,9 +437,11 @@ gsrs.importAdapterFactories.substances =
],
"lineValueDelimiter": ","
}
},
{
}

gsrs.importAdapterFactories.substances.list.ExcelFileImportAdapterFactory ={
"adapterName": "Excel File Adapter",
"order" : 41,
"importAdapterFactoryClass": "gsrs.module.substance.importers.ExcelFileImportAdapterFactory",
"stagingAreaServiceClass": "gsrs.stagingarea.service.DefaultStagingAreaService",
"entityServiceClass" :"gsrs.dataexchange.SubstanceStagingAreaEntityService",
Expand Down Expand Up @@ -567,10 +570,12 @@ gsrs.importAdapterFactories.substances =
],
"lineValueDelimiter": ","
}
},
{
}

gsrs.importAdapterFactories.substances.list.GSRSJSONImportAdapterFactory={
"adapterName": "GSRS JSON Adapter",
"importAdapterFactoryClass": "gsrs.module.substance.importers.GSRSJSONImportAdapterFactory",
"order" : 11,
"importAdapterFactoryClass"= "gsrs.module.substance.importers.GSRSJSONImportAdapterFactory",
"stagingAreaServiceClass": "gsrs.stagingarea.service.DefaultStagingAreaService",
"entityServiceClass" :"gsrs.dataexchange.SubstanceStagingAreaEntityService",
"description" : "GSRS legacy JSON file importer",
Expand All @@ -583,7 +588,6 @@ gsrs.importAdapterFactories.substances =
#the things used to instantiate the adapter

}
}
]
}

gsrs.substance.structures.saltFilePath=salt_data_public.tsv
73 changes: 60 additions & 13 deletions gsrs-module-substances-core/src/main/resources/substances-core.conf
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,17 @@ server.servlet-path=/loop-service

server.use-forward-headers=true

ix.api.registeredfunctions =${ix.api.registeredfunctions}[
#${ix.api.registeredfunctions}
ix.api.registeredfunctions.InChIRegisteredFunction =
{
"class":"ix.core.util.pojopointer.extensions.InChIRegisteredFunction"
},
}

ix.api.registeredfunctions.InChIFullRegisteredFunction=
{
"class":"ix.core.util.pojopointer.extensions.InChIFullRegisteredFunction"
}
]

substance.renderer.style="CONF"
substance.renderer.configPath="substances-default-renderer.json"

Expand All @@ -451,17 +454,61 @@ ix.gsrs.delimitedreports.inchikeysforambiguousstereo=true
#if more than one Exporter supports the same file extension,
#the class in the list that supports it fist wins.

ix.ginas.export.factories.substances = [
#"gsrs.module.substance.ExtraColumnsSpreadsheetExporterFactory",
#"gsrs.module.substance.exporters.SdfExporterFactory",
"gsrs.module.substance.exporters.DefaultSubstanceSpreadsheetExporterFactory",
"gsrs.module.substance.exporters.JsonExporterFactory",
#"ix.ginas.exporters.FDANameExporterFactory",
#"ix.ginas.exporters.FDACodeExporterFactory",
# "ix.ginas.exporters.SPLValidatorXMLExporterFactory",
# "ix.ginas.exporters.SRSLegacyDictionaryExporterFactory"
ix.ginas.export.exporterfactories.substances.list.DefaultSubstanceSpreadsheetExporterFactory =
{
"exporterFactoryClass" = "gsrs.module.substance.exporters.DefaultSubstanceSpreadsheetExporterFactory",
"order" = 1000,
"parameters":{
}
}
ix.ginas.export.exporterfactories.substances.list.JsonExporterFactory =
{
"exporterFactoryClass" = "gsrs.module.substance.exporters.JsonExporterFactory",
"order" = 1100,
"parameters":{
}
}
ix.ginas.export.exporterfactories.substances.list.FDANameExporterFactory =
{
"exporterFactoryClass" = "fda.gsrs.substance.exporters.FDANameExporterFactory",
"order" = 1200,
"disabled" = true,
"parameters":{
}
}
ix.ginas.export.exporterfactories.substances.list.FDACodeExporterFactory =
{
"exporterFactoryClass" = "fda.gsrs.substance.exporters.FDACodeExporterFactory",
"order" = 1300,
"disabled" = true,
"parameters":{
}
}
ix.ginas.export.exporterfactories.substances.list.SPLValidatorXMLExporterFactory =
{
"exporterFactoryClass" = "fda.gsrs.substance.exporters.SPLValidatorXMLExporterFactory",
"order" = 1400,
"disabled" = true,
"parameters":{
}
}
ix.ginas.export.exporterfactories.substances.list.SRSLegacyDictionaryExporterFactory =
{
"exporterFactoryClass" = "fda.gsrs.substance.exporters.SRSLegacyDictionaryExporterFactory",
"order" = 1500,
"disabled" = true,
"parameters":{
}
}

]
ix.ginas.export.exporterfactories.substances.list.SdfExporterFactory =
{
"exporterFactoryClass" = "gsrs.module.substance.exporters.SdfExporterFactory",
"order" = 1600,
"parameters":{
"approvalIDName": "UNII"
}
}

ix.ginas.export.exporterfactories.substances = [
{
Expand Down