diff --git a/gsrs-module-substance-example/src/main/resources/application.conf b/gsrs-module-substance-example/src/main/resources/application.conf index b8e306a34..61ac0bf6e 100644 --- a/gsrs-module-substance-example/src/main/resources/application.conf +++ b/gsrs-module-substance-example/src/main/resources/application.conf @@ -25,23 +25,35 @@ 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"], @@ -49,5 +61,5 @@ gsrs.matchableCalculators.substances = "codeKey": "CODE" } } -] + diff --git a/gsrs-module-substance-example/src/main/resources/fda-extension.conf b/gsrs-module-substance-example/src/main/resources/fda-extension.conf index e53091216..b29a33686 100644 --- a/gsrs-module-substance-example/src/main/resources/fda-extension.conf +++ b/gsrs-module-substance-example/src/main/resources/fda-extension.conf @@ -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", @@ -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", @@ -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 } - - diff --git a/gsrs-module-substance-example/src/test/java/example/imports/DefaultImportAdapterFactoryConfigTest.java b/gsrs-module-substance-example/src/test/java/example/imports/DefaultImportAdapterFactoryConfigTest.java index bd53ce685..2dadc96d9 100644 --- a/gsrs-module-substance-example/src/test/java/example/imports/DefaultImportAdapterFactoryConfigTest.java +++ b/gsrs-module-substance-example/src/test/java/example/imports/DefaultImportAdapterFactoryConfigTest.java @@ -34,7 +34,7 @@ public void testSetup() throws IllegalAccessException, NoSuchFieldException, Jso String substanceContext = "substances"; //build up a complete configuration GsrsFactoryConfiguration config = new GsrsFactoryConfiguration(); - Map>> adapterConfig = new HashMap<>(); + Map>> adapterConfig = new HashMap<>(); Map oneAdapter = new HashMap<>(); oneAdapter.put("importAdapterFactoryClass", "gsrs.module.substance.importers.SDFImportAdapterFactory"); oneAdapter.put("adapterName", "NSRS SDF Adapter"); @@ -42,10 +42,12 @@ public void testSetup() throws IllegalAccessException, NoSuchFieldException, Jso oneAdapter.put("parameters", buildConfigParameters()); oneAdapter.put("stagingAreaServiceClass", gsrs.stagingarea.service.DefaultStagingAreaService.class); oneAdapter.put("entityServiceClass", "gsrs.dataexchange.SubstanceStagingAreaEntityService"); - List> adapters = new ArrayList<>(); - adapters.add(oneAdapter); + Map> adapters = new HashMap<>(); + adapters.put("NSRS SDF Adapter", oneAdapter); adapterConfig.put(substanceContext, adapters); - config.setImportAdapterFactories(adapterConfig); + Map>>> 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); diff --git a/gsrs-module-substance-example/src/test/java/example/imports/StagingAreaServiceTest.java b/gsrs-module-substance-example/src/test/java/example/imports/StagingAreaServiceTest.java index 4089adc72..542384d39 100644 --- a/gsrs-module-substance-example/src/test/java/example/imports/StagingAreaServiceTest.java +++ b/gsrs-module-substance-example/src/test/java/example/imports/StagingAreaServiceTest.java @@ -33,33 +33,33 @@ public void setup() throws NoSuchFieldException, IllegalAccessException { log.trace("setting up staging area service"); stagingAreaService = new DefaultStagingAreaService(); stagingAreaService = AutowireHelper.getInstance().autowireAndProxy(stagingAreaService); - Map>> matchableCalculatorConfig = new HashMap<>(); - List> configs = new ArrayList<>(); + Map>> matchableCalculatorConfig = new HashMap<>(); + Map> configs = new HashMap<>(); Map casExtractor = new HashMap<>(); casExtractor.put("matchableCalculationClass", CASNumberMatchableExtractor.class); LinkedHashMap config= new LinkedHashMap<>(); config.put("casCodeSystems", Arrays.asList("CAS", "CASNo", "CASNumber")); casExtractor.put("config", config); - configs.add(casExtractor); + configs.put("CASNumberMatchableExtractor", casExtractor); Map namesExtractor = new HashMap<>(); namesExtractor.put("matchableCalculationClass", AllNamesMatchableExtractor.class); - configs.add(namesExtractor); + configs.put("AllNamesMatchableExtractor", namesExtractor); Map defHashExtractor = new HashMap<>(); defHashExtractor.put("matchableCalculationClass", DefinitionalHashMatchableExtractor.class); - configs.add(defHashExtractor); + configs.put("DefinitionalHashMatchableExtractor", defHashExtractor); Map selectedCodesExtractor = new HashMap<>(); selectedCodesExtractor.put("matchableCalculationClass", SelectedCodesMatchableExtractor.class); LinkedHashMap 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 uuidExtractor = new HashMap<>(); uuidExtractor.put("matchableCalculationClass", UUIDMatchableExtractor.class); - configs.add(uuidExtractor); + configs.put("UUIDMatchableExtractor", uuidExtractor); matchableCalculatorConfig.put("substances", configs); SubstanceStagingAreaEntityService stagingAreaEntityService = new SubstanceStagingAreaEntityService(); @@ -67,7 +67,9 @@ public void setup() throws NoSuchFieldException, IllegalAccessException { Field factoryConfigField= stagingAreaEntityService.getClass().getDeclaredField("gsrsFactoryConfiguration"); factoryConfigField.setAccessible(true); GsrsFactoryConfiguration factoryConfiguration= (GsrsFactoryConfiguration) factoryConfigField.get(stagingAreaEntityService); - factoryConfiguration.setMatchableCalculators(matchableCalculatorConfig); + Map>>> oneUp = new HashMap<>(); + oneUp.put("matchableCalculatorConfig", matchableCalculatorConfig); + factoryConfiguration.setMatchableCalculators(oneUp); stagingAreaService.registerEntityService(stagingAreaEntityService); } } diff --git a/gsrs-module-substance-example/src/test/resources/application-test.conf b/gsrs-module-substance-example/src/test/resources/application-test.conf index fd6b9dfa9..451c130e8 100644 --- a/gsrs-module-substance-example/src/test/resources/application-test.conf +++ b/gsrs-module-substance-example/src/test/resources/application-test.conf @@ -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", @@ -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", @@ -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", @@ -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", @@ -583,7 +588,6 @@ gsrs.importAdapterFactories.substances = #the things used to instantiate the adapter } - } - ] + } gsrs.substance.structures.saltFilePath=salt_data_public.tsv \ No newline at end of file diff --git a/gsrs-module-substances-core/src/main/resources/substances-core.conf b/gsrs-module-substances-core/src/main/resources/substances-core.conf index 81764fb00..b7db0e52e 100644 --- a/gsrs-module-substances-core/src/main/resources/substances-core.conf +++ b/gsrs-module-substances-core/src/main/resources/substances-core.conf @@ -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" @@ -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 = [ {