-
Notifications
You must be signed in to change notification settings - Fork 1
BI-2132 - Create new experiment workflow #366
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
Merged
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
314d0b1
Added db migration to create workflows
nickpalladino 8fc2f31
Added bean mapping for factory producing appropriate workflow
nickpalladino 4b61708
Added endpoint for retrieving workflows for given mapping id
nickpalladino c1fe8fa
Simplify record mapping
nickpalladino 3ca1a30
Pass workflow id through to import services
nickpalladino c8e0bfe
Add workflow factory to create workflows from ids
nickpalladino 4391479
Add missing file header
nickpalladino 87ffdb5
Add bean to import mapping workflow model
nickpalladino 1c1df39
Added position column to workflows for explicit ordering
nickpalladino 36944a5
Added additional workflow skeletons
nickpalladino 7a9af10
Clean up factory code
nickpalladino 09b9133
Merge branch 'develop' into feature/BI-2122
nickpalladino 0585568
Moved create workflow work to own branch and rearranged things a little
nickpalladino 777b7e2
Added file headers and dynamic column parser
nickpalladino 5564ca1
create micronaut composite pattern classes for experiment import work…
dmeidlin f726611
create FileImportService method for GET workflows
dmeidlin f6952dd
delete unused classes
dmeidlin 5e31aa6
clean up and renaming
dmeidlin 708793d
add overrides to import services
dmeidlin 68bdacb
create ExperimentWorkflow interface that extends Workflow interface
dmeidlin 0e022f1
create interfaces for germplasm and sample workflows
dmeidlin f2a1034
create interfaces
dmeidlin 402eb5d
create DomainImportService abstract class
dmeidlin c5dd139
Shared services work in progress
nickpalladino 8825462
Renamed common services
nickpalladino 2b0256d
Simplified workflow step calling
nickpalladino bce2c7f
change Workflow field names
dmeidlin 6060fcc
use processorManager until Workflow business logic in place
dmeidlin 90f478b
fix workflow navigator injection
dmeidlin 62cf9ac
set the order field for workflows
dmeidlin 57f5cfb
fix npe
dmeidlin d21a988
Merge pull request #360 from Breeding-Insight/feature/BI-2122-A
dmeidlin 644ca0c
Added commit step
nickpalladino c8d1cb6
Building
nickpalladino d57e4ac
Renamed to have github actions run
nickpalladino e406e38
Merge branch 'feature/BI-2122' into feature/BI-2132-A
nickpalladino 79189ba
Messing with dependency issue
nickpalladino 0ef8cd5
Removed ununsed fileImportService injection and resolved DI issue
nickpalladino 1acd04b
Added in BI-2128 change
nickpalladino fc2a661
Merge branch 'develop' into feature/BI-2132-A
nickpalladino 6a4043d
Updated create only tests to use create workflow
nickpalladino 651cffc
Removed unused migration
nickpalladino 39fb8cd
Removed append environment workflow
nickpalladino be8ea38
Fix error message
nickpalladino d11ef3c
Removed navigator stuff handled in domain import service
nickpalladino eebb493
Removed some development comments
nickpalladino b5dc3e8
Reference enum for new-experiment
nickpalladino 2bbf7f3
Change variable name to reflect string type
nickpalladino ccc1414
Clarified comment
nickpalladino 7a35165
Clarified comment
nickpalladino aa06c6e
Removed old comment
nickpalladino dd6f348
Updated doc comment
nickpalladino a6c3590
Cleaned up ProcessedData code
nickpalladino 1a6de32
Changed from workflow to workflowId
nickpalladino a488612
Change exception handling
nickpalladino 9b04d44
Merge branch 'develop' into feature/BI-2132-A
nickpalladino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/java/org/breedinginsight/brapps/importer/model/imports/DomainImportService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /* | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.breedinginsight.brapps.importer.model.imports; | ||
|
|
||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.breedinginsight.brapps.importer.model.imports.experimentObservation.ExperimentObservation; | ||
| import org.breedinginsight.brapps.importer.model.response.ImportPreviewResponse; | ||
| import org.breedinginsight.brapps.importer.model.workflow.ExperimentWorkflow; | ||
| import org.breedinginsight.brapps.importer.model.workflow.ImportWorkflow; | ||
| import org.breedinginsight.brapps.importer.model.workflow.ImportWorkflowResult; | ||
| import org.breedinginsight.brapps.importer.model.workflow.Workflow; | ||
| import org.breedinginsight.brapps.importer.services.processors.ExperimentProcessor; | ||
| import org.breedinginsight.brapps.importer.services.processors.ProcessorManager; | ||
| import org.breedinginsight.brapps.importer.services.processors.experiment.ExperimentWorkflowNavigator; | ||
|
|
||
| import javax.inject.Inject; | ||
| import javax.inject.Provider; | ||
| import javax.inject.Singleton; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| @Singleton | ||
| @Slf4j | ||
| public abstract class DomainImportService implements BrAPIImportService { | ||
|
|
||
| // TODO: delete processor fields once WorkflowNavigator is used | ||
| private final Provider<ExperimentProcessor> experimentProcessorProvider; | ||
| private final Provider<ProcessorManager> processorManagerProvider; | ||
| private final Workflow workflowNavigator; | ||
|
|
||
|
|
||
| public DomainImportService(Provider<ExperimentProcessor> experimentProcessorProvider, | ||
| Provider<ProcessorManager> processorManagerProvider, | ||
| Workflow workflowNavigator) | ||
| { | ||
| this.experimentProcessorProvider = experimentProcessorProvider; | ||
| this.processorManagerProvider = processorManagerProvider; | ||
| this.workflowNavigator = workflowNavigator; | ||
| } | ||
|
|
||
| @Override | ||
| public String getMissingColumnMsg(String columnName) { | ||
| return "Column heading does not match template or ontology"; | ||
| } | ||
| @Override | ||
| public List<ImportWorkflow> getWorkflows() throws Exception{ | ||
| return workflowNavigator.getWorkflows(); | ||
| } | ||
|
|
||
| @Override | ||
| public ImportPreviewResponse process(ImportServiceContext context) | ||
| throws Exception { | ||
|
|
||
| Optional.ofNullable(context.getWorkflowId()) | ||
| .filter(workflowId -> !workflowId.isEmpty()) | ||
| .ifPresent(workflowId -> log.info("Workflow: " + workflowId)); | ||
|
|
||
| // TODO: return results from WorkflowNavigator once processing logic is in separate workflows | ||
| // return workflowNavigator.process(context).flatMap(ImportWorkflowResult::getImportPreviewResponse).orElse(null); | ||
| if (ExperimentWorkflowNavigator.Workflow.NEW_OBSERVATION.getId().equals(context.getWorkflowId())) { | ||
| Optional<ImportWorkflowResult> result = workflowNavigator.process(context); | ||
|
|
||
| // Throw any exceptions caught during workflow processing | ||
| if (result.flatMap(ImportWorkflowResult::getCaughtException).isPresent()) { | ||
| throw result.flatMap(ImportWorkflowResult::getCaughtException).get(); | ||
| } | ||
|
|
||
| return result.flatMap(ImportWorkflowResult::getImportPreviewResponse).orElse(null); | ||
|
|
||
| } else { | ||
| return processorManagerProvider.get().process(context.getBrAPIImports(), | ||
| List.of(experimentProcessorProvider.get()), | ||
| context.getData(), | ||
| context.getProgram(), | ||
| context.getUpload(), | ||
| context.getUser(), | ||
| context.isCommit()); | ||
| } | ||
| } | ||
| } | ||
|
|
42 changes: 42 additions & 0 deletions
42
src/main/java/org/breedinginsight/brapps/importer/model/imports/ImportServiceContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.breedinginsight.brapps.importer.model.imports; | ||
|
|
||
| import lombok.*; | ||
| import org.breedinginsight.brapps.importer.model.ImportUpload; | ||
| import org.breedinginsight.model.Program; | ||
| import org.breedinginsight.model.User; | ||
| import tech.tablesaw.api.Table; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @Builder | ||
| @ToString | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class ImportServiceContext { | ||
| private String workflowId; | ||
| private List<BrAPIImport> brAPIImports; | ||
| private Table data; | ||
| private Program program; | ||
| private ImportUpload upload; | ||
| private User user; | ||
| private boolean commit; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,36 +18,28 @@ | |
| package org.breedinginsight.brapps.importer.model.imports.experimentObservation; | ||
|
|
||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.breedinginsight.brapps.importer.model.ImportUpload; | ||
| import org.breedinginsight.brapps.importer.model.imports.BrAPIImport; | ||
| import org.breedinginsight.brapps.importer.model.imports.BrAPIImportService; | ||
| import org.breedinginsight.brapps.importer.model.response.ImportPreviewResponse; | ||
| import org.breedinginsight.brapps.importer.model.imports.DomainImportService; | ||
| import org.breedinginsight.brapps.importer.services.processors.ExperimentProcessor; | ||
| import org.breedinginsight.brapps.importer.services.processors.Processor; | ||
| import org.breedinginsight.brapps.importer.services.processors.ProcessorManager; | ||
| import org.breedinginsight.model.Program; | ||
| import org.breedinginsight.model.User; | ||
| import tech.tablesaw.api.Table; | ||
| import org.breedinginsight.brapps.importer.services.processors.experiment.ExperimentWorkflowNavigator; | ||
|
|
||
| import javax.inject.Inject; | ||
| import javax.inject.Provider; | ||
| import javax.inject.Singleton; | ||
| import java.util.List; | ||
|
|
||
| @Singleton | ||
| @Slf4j | ||
| public class ExperimentImportService implements BrAPIImportService { | ||
| public class ExperimentImportService extends DomainImportService { | ||
|
|
||
| private final String IMPORT_TYPE_ID = "ExperimentImport"; | ||
|
|
||
| private final Provider<ExperimentProcessor> experimentProcessorProvider; | ||
| private final Provider<ProcessorManager> processorManagerProvider; | ||
|
|
||
| // TODO: delete processor fields once WorkflowNavigator is used | ||
| @Inject | ||
| public ExperimentImportService(Provider<ExperimentProcessor> experimentProcessorProvider, Provider<ProcessorManager> processorManagerProvider) | ||
| public ExperimentImportService(Provider<ExperimentProcessor> experimentProcessorProvider, | ||
| Provider<ProcessorManager> processorManagerProvider, | ||
| ExperimentWorkflowNavigator workflowNavigator) | ||
| { | ||
| this.experimentProcessorProvider = experimentProcessorProvider; | ||
| this.processorManagerProvider = processorManagerProvider; | ||
| super(experimentProcessorProvider, processorManagerProvider, workflowNavigator); | ||
| } | ||
|
Comment on lines
+36
to
43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| @Override | ||
|
|
@@ -60,20 +52,5 @@ public String getImportTypeId() { | |
| return IMPORT_TYPE_ID; | ||
| } | ||
|
|
||
| @Override | ||
| public String getMissingColumnMsg(String columnName) { | ||
| return "Column heading does not match template or ontology"; | ||
| } | ||
|
|
||
| @Override | ||
| public ImportPreviewResponse process(List<BrAPIImport> brAPIImports, Table data, Program program, ImportUpload upload, User user, Boolean commit) | ||
| throws Exception { | ||
|
|
||
| ImportPreviewResponse response = null; | ||
| List<Processor> processors = List.of(experimentProcessorProvider.get()); | ||
| response = processorManagerProvider.get().process(brAPIImports, processors, data, program, upload, user, commit); | ||
| return response; | ||
|
|
||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.