diff --git a/README.md b/README.md index 574f2a9736b79c44dbb176be1aece51797d1e84a..d1a47f05c43aa3d1da12a5b8708aaf81ba2adf34 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ To use this image, you need a running instance of PostgreSQL and to configure th * PORTAL_DB_PASSWORD: Password to use when connecting to the portal database. #### EXTERNAL SERVICES ### -* MIPENGINE_URL: URL to MIPENGINE server. Default is "http://localhost:5000" . * EXAREME_URL: URL to Exareme server. Default is "http://localhost:9090" . +* EXAREME2_URL: URL to Exareme2 server. Default is "http://localhost:5000" . * GALAXY_URL: URL to Workflow server. Default is "http://localhost:8090/" . * GALAXY_API_KEY: The api key to authorize galaxy requests. * GALAXY_USERNAME: The username of galaxy user to be able to embed the frame. diff --git a/config/application.tmpl b/config/application.tmpl index 415e9f469edf2db038335109f933a898f48ed876..d128fe57132353390e95f95f597266b1912b05c4 100644 --- a/config/application.tmpl +++ b/config/application.tmpl @@ -35,10 +35,10 @@ spring: ### EXTERNAL SERVICES ### services: algorithmsUpdateInterval: {{ .Env.ALGORITHM_UPDATE_INTERVAL}} - mipengine: - algorithmsUrl: {{ .Env.MIPENGINE_URL}}/algorithms - attributesUrl: {{ .Env.MIPENGINE_URL}}/data_models_attributes - cdesMetadataUrl: {{ .Env.MIPENGINE_URL}}/cdes_metadata + exareme2: + algorithmsUrl: {{ .Env.EXAREME2_URL}}/algorithms + attributesUrl: {{ .Env.EXAREME2_URL}}/data_models_attributes + cdesMetadataUrl: {{ .Env.EXAREME2_URL}}/cdes_metadata exareme: queryExaremeUrl: {{ default .Env.EXAREME_URL "http://localhost:9090" }}/mining/query diff --git a/src/main/java/eu/hbp/mip/controllers/PathologiesAPI.java b/src/main/java/eu/hbp/mip/controllers/PathologiesAPI.java index 4320f90c7d22f228f8423698b61d8d0a2f10a437..fa1826979cc414090db6376e1e22888f1403ea87 100644 --- a/src/main/java/eu/hbp/mip/controllers/PathologiesAPI.java +++ b/src/main/java/eu/hbp/mip/controllers/PathologiesAPI.java @@ -2,8 +2,8 @@ package eu.hbp.mip.controllers; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import eu.hbp.mip.models.DTOs.MIPEngineAttributesDTO; -import eu.hbp.mip.models.DTOs.MIPEngineCommonDataElement; +import eu.hbp.mip.models.DTOs.Exareme2AttributesDTO; +import eu.hbp.mip.models.DTOs.Exareme2CommonDataElement; import eu.hbp.mip.models.DTOs.PathologyDTO; import eu.hbp.mip.services.ActiveUserService; import eu.hbp.mip.utils.*; @@ -32,11 +32,11 @@ public class PathologiesAPI { @Value("#{'${authentication.enabled}'}") private boolean authenticationIsEnabled; - @Value("#{'${services.mipengine.attributesUrl}'}") - private String mipengineAttributesUrl; + @Value("#{'${services.exareme2.attributesUrl}'}") + private String exareme2AttributesUrl; - @Value("#{'${services.mipengine.cdesMetadataUrl}'}") - private String mipengineCDEsMetadataUrl; + @Value("#{'${services.exareme2.cdesMetadataUrl}'}") + private String exareme2CDEsMetadataUrl; private final ActiveUserService activeUserService; public PathologiesAPI(ActiveUserService activeUserService) { @@ -48,15 +48,15 @@ public class PathologiesAPI { Logger logger = new Logger(activeUserService.getActiveUser().getUsername(), "(GET) /pathologies"); logger.LogUserAction("Loading pathologies ..."); - Map<String, List<PathologyDTO.EnumerationDTO>> datasetsPerPathology = getMIPEngineDatasetsPerPathology(logger); + Map<String, List<PathologyDTO.EnumerationDTO>> datasetsPerPathology = getExareme2DatasetsPerPathology(logger); - Map<String, MIPEngineAttributesDTO> mipEnginePathologyAttributes = getMIPEnginePathologyAttributes(logger); + Map<String, Exareme2AttributesDTO> exareme2PathologyAttributes = getExareme2PathologyAttributes(logger); List<PathologyDTO> pathologyDTOS = new ArrayList<>(); - for (String pathology : mipEnginePathologyAttributes.keySet()) { + for (String pathology : exareme2PathologyAttributes.keySet()) { PathologyDTO newPathology; try { - newPathology = new PathologyDTO(pathology, mipEnginePathologyAttributes.get(pathology), datasetsPerPathology.get(pathology)); + newPathology = new PathologyDTO(pathology, exareme2PathologyAttributes.get(pathology), datasetsPerPathology.get(pathology)); } catch(InternalServerError e) { logger.LogUserAction(e.getMessage()); @@ -76,15 +76,15 @@ public class PathologiesAPI { return ResponseEntity.ok().body(gson.toJson(ClaimUtils.getAuthorizedPathologies(logger, authentication, pathologyDTOS))); } - public Map<String, List<PathologyDTO.EnumerationDTO>> getMIPEngineDatasetsPerPathology(Logger logger) { - Map<String, Map<String, MIPEngineCommonDataElement>> mipEngineCDEsMetadata; - // Get MIPEngine algorithms + public Map<String, List<PathologyDTO.EnumerationDTO>> getExareme2DatasetsPerPathology(Logger logger) { + Map<String, Map<String, Exareme2CommonDataElement>> exareme2CDEsMetadata; + // Get Exareme2 algorithms try { StringBuilder response = new StringBuilder(); - HTTPUtil.sendGet(mipengineCDEsMetadataUrl, response); - mipEngineCDEsMetadata = gson.fromJson( + HTTPUtil.sendGet(exareme2CDEsMetadataUrl, response); + exareme2CDEsMetadata = gson.fromJson( response.toString(), - new TypeToken<HashMap<String, Map<String, MIPEngineCommonDataElement>>>() { + new TypeToken<HashMap<String, Map<String, Exareme2CommonDataElement>>>() { }.getType() ); } catch (Exception e) { @@ -94,7 +94,7 @@ public class PathologiesAPI { Map<String, List<PathologyDTO.EnumerationDTO>> datasetsPerPathology = new HashMap<>(); - mipEngineCDEsMetadata.forEach( (pathology, cdePerDataset) -> { + exareme2CDEsMetadata.forEach( (pathology, cdePerDataset) -> { List<PathologyDTO.EnumerationDTO> pathologyDatasetDTOS = new ArrayList<>(); Map datasetEnumerations = (Map) cdePerDataset.get("dataset").getEnumerations(); datasetEnumerations.forEach((code, label) -> pathologyDatasetDTOS.add(new PathologyDTO.EnumerationDTO((String) code, (String) label))); @@ -106,15 +106,15 @@ public class PathologiesAPI { return datasetsPerPathology; } - public Map<String, MIPEngineAttributesDTO> getMIPEnginePathologyAttributes(Logger logger) { - Map<String, MIPEngineAttributesDTO> mipEnginePathologyAttributes; - // Get MIPEngine algorithms + public Map<String, Exareme2AttributesDTO> getExareme2PathologyAttributes(Logger logger) { + Map<String, Exareme2AttributesDTO> exareme2PathologyAttributes; + // Get Exareme2 algorithms try { StringBuilder response = new StringBuilder(); - HTTPUtil.sendGet(mipengineAttributesUrl, response); - mipEnginePathologyAttributes = gson.fromJson( + HTTPUtil.sendGet(exareme2AttributesUrl, response); + exareme2PathologyAttributes = gson.fromJson( response.toString(), - new TypeToken<HashMap<String, MIPEngineAttributesDTO>>() { + new TypeToken<HashMap<String, Exareme2AttributesDTO>>() { }.getType() ); } catch (Exception e) { @@ -123,6 +123,6 @@ public class PathologiesAPI { } - return mipEnginePathologyAttributes; + return exareme2PathologyAttributes; } } diff --git a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmDTO.java similarity index 64% rename from src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java rename to src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmDTO.java index b373ff3c7a0c45e92703871ebc285cc448324e5d..db5095359df8827a5839b4b0c2ee46c1b1f01a3a 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmDTO.java @@ -1,173 +1,173 @@ -package eu.hbp.mip.models.DTOs; - -import com.google.gson.annotations.SerializedName; -import lombok.AllArgsConstructor; -import lombok.Data; - -import java.util.Hashtable; -import java.util.List; -import java.util.Optional; - -@Data -@AllArgsConstructor -public class MIPEngineAlgorithmDTO { - - @SerializedName("name") - private String name; - - @SerializedName("desc") - private String desc; - - @SerializedName("label") - private String label; - - @SerializedName("type") - private String type; - - @SerializedName("parameters") - private Hashtable<String, MIPEngineAlgorithmParameterDTO> parameters; - - @SerializedName("crossvalidation") - private String crossvalidation; - - @SerializedName("inputdata") - private MIPEngineAlgorithmInputdataDTO inputdata; - - public Optional<Hashtable<String, MIPEngineAlgorithmParameterDTO>> getParameters() { - return Optional.ofNullable(parameters); - } - @SerializedName("preprocessing") - private List<MIPEngineTransformerDTO> preprocessing; - - public Optional<List<MIPEngineTransformerDTO>> getPreprocessing() { - return Optional.ofNullable(preprocessing); - } - - - @Data - @AllArgsConstructor - public static class MIPEngineAlgorithmParameterDTO { - - @SerializedName("label") - private String label; - - @SerializedName("notblank") - private String notblank; - - @SerializedName("multiple") - private String multiple; - - @SerializedName("types") - private List<String> types; - - @SerializedName("desc") - private String desc; - - @SerializedName("min") - private String min; - - @SerializedName("max") - private String max; - - @SerializedName("default") - private String default_value; - - @SerializedName("enums") - private MIPEngineAlgorithmEnumDTO enums; - - @SerializedName("dict_keys_enums") - private MIPEngineAlgorithmEnumDTO dict_keys_enums; - - @SerializedName("dict_values_enums") - private MIPEngineAlgorithmEnumDTO dict_values_enums; - - public Optional<MIPEngineAlgorithmEnumDTO> getEnums() { - return Optional.ofNullable(enums); - } - - @Data - @AllArgsConstructor - public static class MIPEngineAlgorithmEnumDTO { - - @SerializedName("type") - private String type; - - @SerializedName("source") - private List<String> source; - - } - } - - @Data - @AllArgsConstructor - public static class MIPEngineAlgorithmInputdataDTO { - - @SerializedName("x") - private MIPEngineAlgorithmInputDataDetailDTO x; - - @SerializedName("y") - private MIPEngineAlgorithmInputDataDetailDTO y; - - @SerializedName("data_model") - private MIPEngineAlgorithmInputDataDetailDTO data_model; - - @SerializedName("datasets") - private MIPEngineAlgorithmInputDataDetailDTO datasets; - - @SerializedName("filter") - private MIPEngineAlgorithmInputDataDetailDTO filter; - - public Optional<MIPEngineAlgorithmInputDataDetailDTO> getY() { - return Optional.ofNullable(y); - } - - public Optional<MIPEngineAlgorithmInputDataDetailDTO> getX() { - return Optional.ofNullable(x); - } - } - - - - @Data - @AllArgsConstructor - public static class MIPEngineAlgorithmInputDataDetailDTO { - - @SerializedName("stattypes") - private List<String> stattypes; - - @SerializedName("label") - private String label; - - @SerializedName("notblank") - private String notblank; - - @SerializedName("enumslen") - private Integer enumslen; - - @SerializedName("multiple") - private String multiple; - - @SerializedName("types") - private List<String> types; - - @SerializedName("desc") - private String desc; - } - - @Data - @AllArgsConstructor - public static class MIPEngineTransformerDTO { - @SerializedName("name") - private String name; - - @SerializedName("desc") - private String desc; - - @SerializedName("label") - private String label; - - @SerializedName("parameters") - private Hashtable<String, MIPEngineAlgorithmParameterDTO> parameters; - - } -} +package eu.hbp.mip.models.DTOs; + +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.Hashtable; +import java.util.List; +import java.util.Optional; + +@Data +@AllArgsConstructor +public class Exareme2AlgorithmDTO { + + @SerializedName("name") + private String name; + + @SerializedName("desc") + private String desc; + + @SerializedName("label") + private String label; + + @SerializedName("type") + private String type; + + @SerializedName("parameters") + private Hashtable<String, Exareme2AlgorithmParameterDTO> parameters; + + @SerializedName("crossvalidation") + private String crossvalidation; + + @SerializedName("inputdata") + private Exareme2AlgorithmInputdataDTO inputdata; + + public Optional<Hashtable<String, Exareme2AlgorithmParameterDTO>> getParameters() { + return Optional.ofNullable(parameters); + } + @SerializedName("preprocessing") + private List<Exareme2TransformerDTO> preprocessing; + + public Optional<List<Exareme2TransformerDTO>> getPreprocessing() { + return Optional.ofNullable(preprocessing); + } + + + @Data + @AllArgsConstructor + public static class Exareme2AlgorithmParameterDTO { + + @SerializedName("label") + private String label; + + @SerializedName("notblank") + private String notblank; + + @SerializedName("multiple") + private String multiple; + + @SerializedName("types") + private List<String> types; + + @SerializedName("desc") + private String desc; + + @SerializedName("min") + private String min; + + @SerializedName("max") + private String max; + + @SerializedName("default") + private String default_value; + + @SerializedName("enums") + private Exareme2AlgorithmEnumDTO enums; + + @SerializedName("dict_keys_enums") + private Exareme2AlgorithmEnumDTO dict_keys_enums; + + @SerializedName("dict_values_enums") + private Exareme2AlgorithmEnumDTO dict_values_enums; + + public Optional<Exareme2AlgorithmEnumDTO> getEnums() { + return Optional.ofNullable(enums); + } + + @Data + @AllArgsConstructor + public static class Exareme2AlgorithmEnumDTO { + + @SerializedName("type") + private String type; + + @SerializedName("source") + private List<String> source; + + } + } + + @Data + @AllArgsConstructor + public static class Exareme2AlgorithmInputdataDTO { + + @SerializedName("x") + private Exareme2AlgorithmInputDataDetailDTO x; + + @SerializedName("y") + private Exareme2AlgorithmInputDataDetailDTO y; + + @SerializedName("data_model") + private Exareme2AlgorithmInputDataDetailDTO data_model; + + @SerializedName("datasets") + private Exareme2AlgorithmInputDataDetailDTO datasets; + + @SerializedName("filter") + private Exareme2AlgorithmInputDataDetailDTO filter; + + public Optional<Exareme2AlgorithmInputDataDetailDTO> getY() { + return Optional.ofNullable(y); + } + + public Optional<Exareme2AlgorithmInputDataDetailDTO> getX() { + return Optional.ofNullable(x); + } + } + + + + @Data + @AllArgsConstructor + public static class Exareme2AlgorithmInputDataDetailDTO { + + @SerializedName("stattypes") + private List<String> stattypes; + + @SerializedName("label") + private String label; + + @SerializedName("notblank") + private String notblank; + + @SerializedName("enumslen") + private Integer enumslen; + + @SerializedName("multiple") + private String multiple; + + @SerializedName("types") + private List<String> types; + + @SerializedName("desc") + private String desc; + } + + @Data + @AllArgsConstructor + public static class Exareme2TransformerDTO { + @SerializedName("name") + private String name; + + @SerializedName("desc") + private String desc; + + @SerializedName("label") + private String label; + + @SerializedName("parameters") + private Hashtable<String, Exareme2AlgorithmParameterDTO> parameters; + + } +} diff --git a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmRequestDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmRequestDTO.java similarity index 83% rename from src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmRequestDTO.java rename to src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmRequestDTO.java index 6d71623d434034836315fb5a01273e4d812c915d..7df8a3cc516fa1f00102875497b7778dc0de93d9 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAlgorithmRequestDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AlgorithmRequestDTO.java @@ -9,7 +9,7 @@ import java.util.*; @Data @AllArgsConstructor -public class MIPEngineAlgorithmRequestDTO { +public class Exareme2AlgorithmRequestDTO { @SerializedName("request_id") private String request_id; @SerializedName("inputdata") @@ -19,11 +19,11 @@ public class MIPEngineAlgorithmRequestDTO { @SerializedName("preprocessing") private HashMap<String, Object> preprocessing; - public MIPEngineAlgorithmRequestDTO(UUID experimentUUID, List<ExaremeAlgorithmRequestParamDTO> exaremeAlgorithmRequestParamDTOs, List<ExaremeAlgorithmDTO.Transformer> exaremeTransformers) { + public Exareme2AlgorithmRequestDTO(UUID experimentUUID, List<ExaremeAlgorithmRequestParamDTO> exaremeAlgorithmRequestParamDTOs, List<ExaremeAlgorithmDTO.Transformer> exaremeTransformers) { this.request_id = experimentUUID.toString(); - MIPEngineAlgorithmRequestDTO.InputData inputData = new MIPEngineAlgorithmRequestDTO.InputData(); - HashMap<String, Object> mipEngineParameters = new HashMap<>(); - HashMap<String, Object> mipEnginePreprocessing = new HashMap<>(); + Exareme2AlgorithmRequestDTO.InputData inputData = new Exareme2AlgorithmRequestDTO.InputData(); + HashMap<String, Object> exareme2Parameters = new HashMap<>(); + HashMap<String, Object> exareme2Preprocessing = new HashMap<>(); exaremeAlgorithmRequestParamDTOs.forEach(parameter -> { @@ -45,10 +45,10 @@ public class MIPEngineAlgorithmRequestDTO { break; case "filter": if (parameter.getValue() != null && !parameter.getValue().equals("")) - inputData.setFilters(JsonConverters.convertJsonStringToObject(parameter.getValue(), MIPEngineAlgorithmRequestDTO.Filter.class)); + inputData.setFilters(JsonConverters.convertJsonStringToObject(parameter.getValue(), Exareme2AlgorithmRequestDTO.Filter.class)); break; default: - mipEngineParameters.put(parameter.getName(), convertStringToMultipleValues(parameter.getValue())); + exareme2Parameters.put(parameter.getName(), convertStringToMultipleValues(parameter.getValue())); } }); if (exaremeTransformers.size() > 0) { @@ -64,12 +64,12 @@ public class MIPEngineAlgorithmRequestDTO { transformerParameterDTOs.put(parameter.getName(), convertStringToMultipleValues(parameter.getValue())); } } - mipEnginePreprocessing.put(transformer.getName(), transformerParameterDTOs); + exareme2Preprocessing.put(transformer.getName(), transformerParameterDTOs); }); } this.inputdata = inputData; - this.parameters = mipEngineParameters; - this.preprocessing = mipEnginePreprocessing; + this.parameters = exareme2Parameters; + this.preprocessing = exareme2Preprocessing; } private static Object convertStringToMultipleValues(String str) { diff --git a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAttributesDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AttributesDTO.java similarity index 79% rename from src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAttributesDTO.java rename to src/main/java/eu/hbp/mip/models/DTOs/Exareme2AttributesDTO.java index 1da25fe9197571387aeb223c498e04a8b53e6dfc..aaaa627db9582dee2c970ad2a7a4271dcf33d37e 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineAttributesDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2AttributesDTO.java @@ -4,14 +4,12 @@ import com.google.gson.annotations.SerializedName; import lombok.AllArgsConstructor; import lombok.Data; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @Data @AllArgsConstructor -public class MIPEngineAttributesDTO { +public class Exareme2AttributesDTO { @SerializedName("properties") private Map<String, List<MetadataHierarchyDTO>> properties; diff --git a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineCommonDataElement.java b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2CommonDataElement.java similarity index 95% rename from src/main/java/eu/hbp/mip/models/DTOs/MIPEngineCommonDataElement.java rename to src/main/java/eu/hbp/mip/models/DTOs/Exareme2CommonDataElement.java index 9d81a3c77a944c63cbc53cb510264c19e77dd9c0..786bf76308803119ffc3c22299fc91922127602a 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/MIPEngineCommonDataElement.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/Exareme2CommonDataElement.java @@ -7,7 +7,7 @@ import lombok.Data; @Data @AllArgsConstructor -public class MIPEngineCommonDataElement { +public class Exareme2CommonDataElement { @SerializedName("is_categorical") private Boolean is_categorical; diff --git a/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmDTO.java index cfa6ca97d26011d740ca84151a377b7431951bcf..16d68771a4c305b5334a40f12a5e5dbbd5b56b36 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmDTO.java @@ -33,32 +33,32 @@ public class ExaremeAlgorithmDTO { } - public ExaremeAlgorithmDTO(MIPEngineAlgorithmDTO mipEngineAlgorithm) { - this.name = mipEngineAlgorithm.getName().toUpperCase(); - this.label = mipEngineAlgorithm.getLabel(); - this.desc = mipEngineAlgorithm.getDesc(); - this.type = "mipengine"; + public ExaremeAlgorithmDTO(Exareme2AlgorithmDTO exareme2Algorithm) { + this.name = exareme2Algorithm.getName().toUpperCase(); + this.label = exareme2Algorithm.getLabel(); + this.desc = exareme2Algorithm.getDesc(); + this.type = "exareme2"; List<ExaremeAlgorithmRequestParamDTO> parameters = new ArrayList<>(); - if (mipEngineAlgorithm.getInputdata().getY().isPresent()) { - parameters.add(new ExaremeAlgorithmRequestParamDTO("y", mipEngineAlgorithm.getInputdata().getY().get())); + if (exareme2Algorithm.getInputdata().getY().isPresent()) { + parameters.add(new ExaremeAlgorithmRequestParamDTO("y", exareme2Algorithm.getInputdata().getY().get())); } - if (mipEngineAlgorithm.getInputdata().getX().isPresent()) { - parameters.add(new ExaremeAlgorithmRequestParamDTO("x", mipEngineAlgorithm.getInputdata().getX().get())); + if (exareme2Algorithm.getInputdata().getX().isPresent()) { + parameters.add(new ExaremeAlgorithmRequestParamDTO("x", exareme2Algorithm.getInputdata().getX().get())); } - parameters.add(new ExaremeAlgorithmRequestParamDTO("pathology", mipEngineAlgorithm.getInputdata().getData_model())); - parameters.add(new ExaremeAlgorithmRequestParamDTO("dataset", mipEngineAlgorithm.getInputdata().getDatasets())); - parameters.add(new ExaremeAlgorithmRequestParamDTO("filter", mipEngineAlgorithm.getInputdata().getFilter())); - if (mipEngineAlgorithm.getParameters().isPresent()) { - mipEngineAlgorithm.getParameters().get().forEach((name, parameterDTO) -> { + parameters.add(new ExaremeAlgorithmRequestParamDTO("pathology", exareme2Algorithm.getInputdata().getData_model())); + parameters.add(new ExaremeAlgorithmRequestParamDTO("dataset", exareme2Algorithm.getInputdata().getDatasets())); + parameters.add(new ExaremeAlgorithmRequestParamDTO("filter", exareme2Algorithm.getInputdata().getFilter())); + if (exareme2Algorithm.getParameters().isPresent()) { + exareme2Algorithm.getParameters().get().forEach((name, parameterDTO) -> { ExaremeAlgorithmRequestParamDTO parameter = new ExaremeAlgorithmRequestParamDTO(name, parameterDTO); parameters.add(parameter); }); } this.parameters = parameters; List<Transformer> preprocessing = new ArrayList<>(); - if (mipEngineAlgorithm.getPreprocessing().isPresent()) { - mipEngineAlgorithm.getPreprocessing().get().forEach(mipEngineTransformerDTO -> { - Transformer transformer = new Transformer(mipEngineTransformerDTO); + if (exareme2Algorithm.getPreprocessing().isPresent()) { + exareme2Algorithm.getPreprocessing().get().forEach(exareme2TransformerDTO -> { + Transformer transformer = new Transformer(exareme2TransformerDTO); preprocessing.add(transformer); }); this.preprocessing = preprocessing; @@ -82,7 +82,7 @@ public class ExaremeAlgorithmDTO { private List<ExaremeAlgorithmRequestParamDTO> parameters; - public Transformer(MIPEngineAlgorithmDTO.MIPEngineTransformerDTO transformerDTO) { + public Transformer(Exareme2AlgorithmDTO.Exareme2TransformerDTO transformerDTO) { this.name = transformerDTO.getName().toUpperCase(); this.label = transformerDTO.getLabel(); this.desc = transformerDTO.getDesc(); diff --git a/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmRequestParamDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmRequestParamDTO.java index 5d9c354409461add8007a7b3f4cd2f4b09cd7d82..ab80e2852bb8ef777ef68c4400c33304ad71a27e 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmRequestParamDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/ExaremeAlgorithmRequestParamDTO.java @@ -55,7 +55,7 @@ public class ExaremeAlgorithmRequestParamDTO { private List<String> valueEnumerations; public ExaremeAlgorithmRequestParamDTO (){} - public ExaremeAlgorithmRequestParamDTO (String name, MIPEngineAlgorithmDTO.MIPEngineAlgorithmParameterDTO parameter){ + public ExaremeAlgorithmRequestParamDTO (String name, Exareme2AlgorithmDTO.Exareme2AlgorithmParameterDTO parameter){ this.name = name; this.desc = parameter.getDesc(); this.valueType = parameter.getTypes().get(0); @@ -69,7 +69,7 @@ public class ExaremeAlgorithmRequestParamDTO { this.valueMin = parameter.getMin(); } - public ExaremeAlgorithmRequestParamDTO (String name, MIPEngineAlgorithmDTO.MIPEngineAlgorithmInputDataDetailDTO inputDataDetail){ + public ExaremeAlgorithmRequestParamDTO (String name, Exareme2AlgorithmDTO.Exareme2AlgorithmInputDataDetailDTO inputDataDetail){ this.name = name; this.desc = inputDataDetail.getDesc(); this.value = ""; diff --git a/src/main/java/eu/hbp/mip/models/DTOs/PathologyDTO.java b/src/main/java/eu/hbp/mip/models/DTOs/PathologyDTO.java index de85a0fa22bea20e9f8f2892ab0e27ecee422ae4..127f1eb2d38a1bdd42c761d52d4ec343d95a334f 100644 --- a/src/main/java/eu/hbp/mip/models/DTOs/PathologyDTO.java +++ b/src/main/java/eu/hbp/mip/models/DTOs/PathologyDTO.java @@ -33,8 +33,8 @@ public class PathologyDTO { } - public PathologyDTO(String pathology, MIPEngineAttributesDTO mipEngineAttributesDTO, List<EnumerationDTO> pathologyDatasetDTOS) { - MetadataHierarchyDTO metadataHierarchyDTO = mipEngineAttributesDTO.getProperties().get("cdes").get(0); + public PathologyDTO(String pathology, Exareme2AttributesDTO exareme2AttributesDTO, List<EnumerationDTO> pathologyDatasetDTOS) { + MetadataHierarchyDTO metadataHierarchyDTO = exareme2AttributesDTO.getProperties().get("cdes").get(0); if (!metadataHierarchyDTO.isDatasetCDEPresent()) throw new InternalServerError("CommonDataElement Dataset was not present in the pathology:" + pathology); metadataHierarchyDTO.updateDatasetCde(pathologyDatasetDTOS); diff --git a/src/main/java/eu/hbp/mip/services/AlgorithmService.java b/src/main/java/eu/hbp/mip/services/AlgorithmService.java index cf5d797f0d6c46dc0bfc2eda09bc5fb9ee977a18..93e22a297f33404c6aa1ee66e677ee34ca42ad5a 100644 --- a/src/main/java/eu/hbp/mip/services/AlgorithmService.java +++ b/src/main/java/eu/hbp/mip/services/AlgorithmService.java @@ -9,7 +9,7 @@ import com.google.gson.reflect.TypeToken; import eu.hbp.mip.controllers.galaxy.retrofit.RetroFitGalaxyClients; import eu.hbp.mip.controllers.galaxy.retrofit.RetrofitClientInstance; import eu.hbp.mip.models.DTOs.ExaremeAlgorithmDTO; -import eu.hbp.mip.models.DTOs.MIPEngineAlgorithmDTO; +import eu.hbp.mip.models.DTOs.Exareme2AlgorithmDTO; import eu.hbp.mip.models.galaxy.WorkflowDTO; import eu.hbp.mip.utils.CustomResourceLoader; import eu.hbp.mip.utils.Exceptions.BadRequestException; @@ -38,8 +38,8 @@ public class AlgorithmService { private ArrayList<ExaremeAlgorithmDTO> algorithmDTOS = new ArrayList<>(); - @Value("#{'${services.mipengine.algorithmsUrl}'}") - private String mipengineAlgorithmsUrl; + @Value("#{'${services.exareme2.algorithmsUrl}'}") + private String exareme2AlgorithmsUrl; @Value("#{'${services.exareme.algorithmsUrl}'}") private String exaremeAlgorithmsUrl; @@ -62,16 +62,16 @@ public class AlgorithmService { } public void update(Logger logger) { - ArrayList<ExaremeAlgorithmDTO> mipengineAlgorithms = getMIPEngineAlgorithms(logger); + ArrayList<ExaremeAlgorithmDTO> exareme2Algorithms = getExareme2Algorithms(logger); ArrayList<ExaremeAlgorithmDTO> exaremeAlgorithms = getExaremeAlgorithms(logger); ArrayList<ExaremeAlgorithmDTO> galaxyAlgorithms = getGalaxyWorkflows(logger); ArrayList<ExaremeAlgorithmDTO> algorithms = new ArrayList<>(); // Remove Exareme algorithms that exist in the Exareme2 - if (mipengineAlgorithms != null && exaremeAlgorithms != null){ + if (exareme2Algorithms != null && exaremeAlgorithms != null){ int old_exareme_algorithm_size = exaremeAlgorithms.size(); - for (ExaremeAlgorithmDTO algorithm : mipengineAlgorithms) { + for (ExaremeAlgorithmDTO algorithm : exareme2Algorithms) { exaremeAlgorithms.removeIf(obj -> Objects.equals(obj.getName(), algorithm.getName())); } logger.LogUserAction("Removed "+ (old_exareme_algorithm_size - exaremeAlgorithms.size()) +" deprecated exareme algorithms"); @@ -83,11 +83,11 @@ public class AlgorithmService { } else { logger.LogUserAction("Fetching exareme algorithms failed"); } - if (mipengineAlgorithms != null) { - algorithms.addAll(mipengineAlgorithms); - logger.LogUserAction("Loaded " + mipengineAlgorithms.size() + " mipengine algorithms"); + if (exareme2Algorithms != null) { + algorithms.addAll(exareme2Algorithms); + logger.LogUserAction("Loaded " + exareme2Algorithms.size() + " exareme2 algorithms"); } else { - logger.LogUserAction("Fetching mipengine algorithms failed"); + logger.LogUserAction("Fetching exareme2 algorithms failed"); } if (galaxyAlgorithms != null) { algorithms.addAll(galaxyAlgorithms); @@ -143,8 +143,8 @@ public class AlgorithmService { private String getAlgorithmEngineType(ExaremeAlgorithmDTO algorithmDTO){ switch (algorithmDTO.getType()) { - case "mipengine": - return "MIP-Engine"; + case "exareme2": + return "Exareme2"; case "workflow": return "Galaxy"; default: @@ -178,19 +178,19 @@ public class AlgorithmService { } /** - * This method gets all the available mipengine algorithms and + * This method gets all the available exareme2 algorithms and * * @return a list of AlgorithmDTOs or null if something fails */ - public ArrayList<ExaremeAlgorithmDTO> getMIPEngineAlgorithms(Logger logger) { - ArrayList<MIPEngineAlgorithmDTO> mipEngineAlgorithms; - // Get MIPEngine algorithms + public ArrayList<ExaremeAlgorithmDTO> getExareme2Algorithms(Logger logger) { + ArrayList<Exareme2AlgorithmDTO> exareme2Algorithms; + // Get Exareme2 algorithms try { StringBuilder response = new StringBuilder(); - HTTPUtil.sendGet(mipengineAlgorithmsUrl, response); - mipEngineAlgorithms = gson.fromJson( + HTTPUtil.sendGet(exareme2AlgorithmsUrl, response); + exareme2Algorithms = gson.fromJson( response.toString(), - new TypeToken<ArrayList<MIPEngineAlgorithmDTO>>() { + new TypeToken<ArrayList<Exareme2AlgorithmDTO>>() { }.getType() ); } catch (Exception e) { @@ -199,7 +199,7 @@ public class AlgorithmService { } ArrayList<ExaremeAlgorithmDTO> algorithms = new ArrayList<>(); - mipEngineAlgorithms.forEach(mipEngineAlgorithm -> algorithms.add(new ExaremeAlgorithmDTO(mipEngineAlgorithm))); + exareme2Algorithms.forEach(exareme2Algorithm -> algorithms.add(new ExaremeAlgorithmDTO(exareme2Algorithm))); logger.LogUserAction("Completed, returned " + algorithms.size() + " Exareme2 algorithms."); return algorithms; diff --git a/src/main/java/eu/hbp/mip/services/ExperimentService.java b/src/main/java/eu/hbp/mip/services/ExperimentService.java index 7dc7d16b5dd88521fe98f3c470107e8a3a0f7bc4..9fe7e4cf9e507f3ed8b2ae4895bf7b098330a304 100644 --- a/src/main/java/eu/hbp/mip/services/ExperimentService.java +++ b/src/main/java/eu/hbp/mip/services/ExperimentService.java @@ -32,8 +32,8 @@ public class ExperimentService { @Value("#{'${services.exareme.queryExaremeUrl}'}") private String queryExaremeUrl; - @Value("#{'${services.mipengine.algorithmsUrl}'}") - private String mipengineAlgorithmsUrl; + @Value("#{'${services.exareme2.algorithmsUrl}'}") + private String exareme2AlgorithmsUrl; @Value("#{'${authentication.enabled}'}") private boolean authenticationIsEnabled; @@ -410,7 +410,7 @@ public class ExperimentService { /** * Creates an experiment and runs it on the background. - * Uses the exareme or mip-engine engine that run an experiment synchronously. + * Uses the exareme or exareme2 engine that run an experiment synchronously. * * @param experimentDTO is the request with the experiment information * @param logger contains username and the endpoint. @@ -454,15 +454,15 @@ public class ExperimentService { } /** - * Runs the experiment to exareme or MIPEngine, waiting for the response from them. - * Exareme and MIP-Engine do not support async fetching of an algorithm result. + * Runs the experiment to exareme or Exareme2, waiting for the response from them. + * Exareme and Exareme2 do not support async fetching of an algorithm result. * * @param experimentDTO is the request with the experiment information * @return the result of experiment as well as the http status that was retrieved */ private ExaremeAlgorithmResultDTO runSynchronousExperiment(ExperimentDTO experimentDTO, String algorithmEngineName, Logger logger) { - if (algorithmEngineName.equals("MIP-Engine")) { - return runMIPEngineExperiment(experimentDTO, logger); + if (algorithmEngineName.equals("Exareme2")) { + return runExareme2Experiment(experimentDTO, logger); } else { return runExaremeExperiment(experimentDTO, logger); } @@ -517,22 +517,22 @@ public class ExperimentService { } /** - * The runMIPEngineExperiment will run an experiment using the MIP-Engine + * The runExareme2Experiment will run an experiment using the Exareme2 * * @param experimentDTO contains the information needed to run the experiment * @param logger is used to log * @return the result of the algorithm */ - private ExaremeAlgorithmResultDTO runMIPEngineExperiment(ExperimentDTO experimentDTO, Logger logger) { + private ExaremeAlgorithmResultDTO runExareme2Experiment(ExperimentDTO experimentDTO, Logger logger) { String algorithmName = experimentDTO.getAlgorithm().getName(); - logger.LogUserAction("Starting MIP-Engine algorithm execution, algorithm: " + algorithmName); + logger.LogUserAction("Starting Exareme2 algorithm execution, algorithm: " + algorithmName); - String algorithmEndpoint = mipengineAlgorithmsUrl + "/" + algorithmName.toLowerCase(); - MIPEngineAlgorithmRequestDTO mipEngineAlgorithmRequestDTO = - new MIPEngineAlgorithmRequestDTO(experimentDTO.getUuid(), experimentDTO.getAlgorithm().getParameters(), experimentDTO.getAlgorithm().getPreprocessing()); - String algorithmBody = JsonConverters.convertObjectToJsonString(mipEngineAlgorithmRequestDTO); - logger.LogUserAction("MIP-Engine algorithm execution. Endpoint: " + algorithmEndpoint); - logger.LogUserAction("MIP-Engine algorithm execution. Body: " + algorithmBody); + String algorithmEndpoint = exareme2AlgorithmsUrl + "/" + algorithmName.toLowerCase(); + Exareme2AlgorithmRequestDTO exareme2AlgorithmRequestDTO = + new Exareme2AlgorithmRequestDTO(experimentDTO.getUuid(), experimentDTO.getAlgorithm().getParameters(), experimentDTO.getAlgorithm().getPreprocessing()); + String algorithmBody = JsonConverters.convertObjectToJsonString(exareme2AlgorithmRequestDTO); + logger.LogUserAction("Exareme2 algorithm execution. Endpoint: " + algorithmEndpoint); + logger.LogUserAction("Exareme2 algorithm execution. Body: " + algorithmBody); StringBuilder requestResponseBody = new StringBuilder(); int requestResponseCode; @@ -545,9 +545,9 @@ public class ExperimentService { List<Object> exaremeAlgorithmResult = new ArrayList<>(); if (requestResponseCode == 200) { - Object mipEngineResult = + Object exareme2Result = JsonConverters.convertJsonStringToObject(String.valueOf(requestResponseBody), Object.class); - exaremeAlgorithmResult.add(mipEngineResult); + exaremeAlgorithmResult.add(exareme2Result); } else if (requestResponseCode == 400) { Map<String, Object> exaremeAlgorithmResultElement = new HashMap<>(); @@ -583,7 +583,7 @@ public class ExperimentService { } else { logger.LogUserAction( - "MIP-Engine execution responded with an unexpected status code: " + requestResponseCode + "Exareme2 execution responded with an unexpected status code: " + requestResponseCode ); throw new InternalServerError(""); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6d59ce9cbf057dd21b7c9ddf2c44963def747273..ae29362afd45bb1751b189cf2b3f838fce12705b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -35,7 +35,7 @@ spring: ### EXTERNAL SERVICES ### services: algorithmsUpdateInterval: 100 - mipengine: + exareme2: algorithmsUrl: "http://127.0.0.1:5000/algorithms" attributesUrl: "http://127.0.0.1:5000/data_models_attributes" cdesMetadataUrl: "http://127.0.0.1:5000/cdes_metadata"