|
| 1 | +## Outline: |
| 2 | +* [Introduction](introduction) |
| 3 | +* [Importer Workflow](importer-workflow) |
| 4 | +* [Job Configuration Specs](job-config-specs) |
| 5 | +* [Step Configuration Specs](step-config-specs) |
| 6 | + |
| 7 | +# [Introduction](introduction) |
| 8 | +The Spring Batch importer comprises one job with a series of steps that are executed sequentially or in parallel depending on their datatype. For reference, the importer workflow diagram can be viewed [here](ImporterWorkflowDiagram.pdf). |
| 9 | + |
| 10 | +The `application.properties` file requires the following: |
| 11 | +* `spring.batch.job.enabled`=false |
| 12 | +* `chunk.interval`= some integer that will be set as the chunk processing interval value |
| 13 | +* `db.user`= the db username |
| 14 | +* `db.password`= the db password |
| 15 | +* `db.driver`= the driver classname |
| 16 | +* `db.connection_string`= the db connection string |
| 17 | +* `db.portal_db_name`= the db name |
| 18 | +* `db.url`= the db url |
| 19 | +* `db.version=${db.version}`: db.version is defined in the master pom file |
| 20 | + |
| 21 | +The user must pass one argument when running the importer (`-s`, `--staging`) which will be added to the `JobExecutionContext` as a `JobParameter` called `stagingDirectory`. The following is an example command for importing a cancer study at a specified directory: |
| 22 | + |
| 23 | +``` |
| 24 | +$JAVA_HOME/bin/java -jar importer/target/importer-0.1.0.jar -s /path/to/cancer/study |
| 25 | +``` |
| 26 | + |
| 27 | +# [Importer Workflow](importer-workflow): |
| 28 | +The following describes the components of the batch importer job and its steps. |
| 29 | + |
| 30 | +## [Job Configuration Specs](job-config-specs): |
| 31 | +* `JobExecutionListener`: Used for letting user know whether cancer study data successfully imported or not. |
| 32 | +* `JobExecutionDecider`: Checks the DB schema version and stops the job if the DB version does not match what is expected for the portal. If the DB schema does not match what is expected then the `JobExecutionDecider` sets the `FlowExecutionStatus` to **STOPPED**. Otherwise, the `FlowExecutionStatus` is set to **CONTINUE**. |
| 33 | +* `Flow`: Defines the conditional flow for importing a cancer study based on the `FlowExecutionStatus` from the `JobExecutionDecider`. On **STOPPED**, the job execution is halted and the application closes. On **CONTINUE**, the job attempts to import a cancer study based on the staging directory passed on the command line. |
| 34 | + |
| 35 | +## [Step Configuration Specs](step-config-specs) |
| 36 | +* [Cancer Study Step](cancer-study-step) |
| 37 | +* [Clinical Data Step](clinical-data-step) |
| 38 | +* [Mutation Data Step](mutation-data-step) |
| 39 | + |
| 40 | +### [Cancer Study Step](cancer-study-step): |
| 41 | +Importing cancer study data will be executed by the `importCancerStudy` Step (executed by the main batch importer job described in [Job Configuration Specs](job-config-specs). |
| 42 | +* `StepExecutionListener`: Used for setting the `ExitStatus` to **STOPPED** after the step has executed if the cancer study metadata could not be imported or if the cancer study metadata could not be loaded from `meta_study.txt`. |
| 43 | +* `Tasklet`: Used for loading cancer study metadata from `meta_study.txt`. If a cancer study already exists by the cancer study identifier then the existing study is deleted and the new study is imported. |
| 44 | +* `JobExecutionDecider`: Used to determine whether the impor job should continue or not. If the cancer study metadata was successfully loaded and imported into the DB then the `FlowExecutionStatus` is set to **CONTINUE**, otherwise the `FlowExecutionStatus` is set to **STOPPED**. |
| 45 | +* `Flow`: Defines the conditional flow for importing other datatypes for a cancer study based on the `FlowExecutionStatus` from the `JobExecutionDecider`. If the `FlowExecutionStatus` is set to **CONTINUE** then the job will continue executing by first loading and importing clinical data and then executing the remaining import steps in parallel. |
| 46 | + |
| 47 | +### [Clinical Data Step](clinical-data-step) |
| 48 | +The following datatypes are loaded and imported sequentially if metadata files are found for them: |
| 49 | + |
| 50 | +| Datatype | Meta Filename | Data Filename | Status | Step Name | |
| 51 | +| ---------------- | ------------------------- | ------------------------- | ------------- | ------------------- | |
| 52 | +| clinical | meta_clinical.txt | data_clinical.txt | **Complete** | clinicalStep | |
| 53 | +| clinical-patient | meta_clinical_patient.txt | data_clinical_patient.txt | **Complete** | clinicalPatientStep | |
| 54 | +| clinical-sample | meta_clinical_sample.txt | data_clinical_sample.txt | **Complete** | clinicalSampleStep | |
| 55 | +| clinical-supp | meta_clinical.txt | data_clinical_supp*.txt | **Complete** | clinicalSuppStep | |
| 56 | +| bcr-clinical | meta_bcr_clinical*.txt | data_bcr_clinical*.txt | _In Progress_ | -- | |
| 57 | +| clinical-caises | meta_clinical_caises.txt | data_clinical_caises.xml | _In Progress_ | -- | |
| 58 | + |
| 59 | +A main Flow (`clinicalStepFlow`) will execute the Steps for importing each clinical datatype sequentially. All clinical datatype steps will have the following components in common: |
| 60 | +* `JobExecutionDecider`: Searches the cancer study path for a datatype's meta filename and data filename. If the meta file exists and data files can be found then the `FlowExecutionStatus` is set to **RUN** and the current step name is injected into the `JobExecutionContext`, otherwise the `FlowExecutionStatus` is set to **SKIP**. |
| 61 | +* `Tasklet`: A universal tasklet loads clinical attributes from a list of clinical datafiles based on the data filename corresponding to the `currentStep` stored in the `JobExecutionContext`. It is assumed that metadata for clinical attributes are stored at the top of the file and that the clinical datafile(s) have passed validation. A HashMap of data filenames and clinical attributes loaded are injected into the `JobExecutionContext` to be used by the clinical data readers, processors, and writers. |
| 62 | +* `Step`: A universal step builder for clinical data implements the reading, processing, and writing of clinical data using the HashMap of datafile clinical attributes loaded from the `Tasklet` above. |
| 63 | +* `StepExecutionListener`: Before the clinical datatype step executes, the listener will add the cancer study imported from [Cancer Study Step](cancer-study-step) to the `StepExecutionContext`, as well as the datafile clinical attributes loaded from the `Tasklet` described above. After the clinical datatype step executes, the listener will report how many patient records, sample records, patient clinical data, and sample clinical data were loaded and imported into the db, as well as how many rollbacks or skips occurred during import. |
| 64 | + |
| 65 | +### [Mutation Data Step](mutation-data-step) |
| 66 | +The following datatypes are loaded and imported in parallel if metadata files are found for them: |
| 67 | + |
| 68 | +| Datatype | Meta Filename | Data Filename | Status | Step Name | |
| 69 | +| ------------------- | --------------------------- | -------------------------------------- | ------------- | ---------------------- | |
| 70 | +| mutation | meta_mutations_extended.txt | data_mutations_extended*.txt | **Complete** | mutationStep | |
| 71 | +| mutation-germline | meta_mutations_extended.txt | data_mutations_germline.txt | **Complete** | mutationGermlineStep | |
| 72 | +| mutation-foundation | meta_mutations_extended.txt | data_mutations_extended_foundation.txt | **Complete** | mutationFoundationStep | |
| 73 | +| mutation-unfiltered | meta_mutations_extended.txt | data_mutations_unfiltered.txt | _In Progress_ | -- | |
| 74 | +| mutation-manual | meta_mutations_extended.txt | data_mutations_manual.txt | _In Progress_ | -- | |
| 75 | +_* **Note:**_ `data_mutations_extended_foundation.txt` _is filtered out of the list of datafiles when searching for filename pattern_ `data_mutations_extended*.txt` _for datatype_ `mutation`. |
| 76 | + |
| 77 | +A main Flow (`mutationStepFlow`) will execute the Steps for importing each mutation datatype sequentially. All mutation datatype steps will have the following components in common: |
| 78 | +* `JobExecutionDecider`: Searches the cancer study path for a datatype's meta filename and data filename. If the meta file exists and the data files can be found then the `FlowExecutionStatus` is set to **RUN** and the current step name is injected into the `JobExecutionContext`, otherwise the `FlowExecutionStatus` is set to **SKIP**. To avoid loading and importing the `data_mutations_extended_foundation.txt` during the general mutation step, the mutation-foundation data filename is filtered |
| 79 | +* `Tasklets`: Two universal tasklets are used for mutation data steps. One tasklet loads and imports a genetic profile from a datatype's metafile and injects the genetic profile into the `JobExecutionContext`. The second tasklet injects the list of datafiles into the `JobExecutionContext`, as well as a MultiKeyMap of the headers of each MAF file and number of records in the file (row count). These information are used by the mutation data readers, processors, and writers. |
| 80 | +* `Step`: A universal step builder for mutation data implements the reading, processing, and writing of mutation data using the genetic profile and the MultiKeyMap of MAF file metadata (headers and number of records in file) loaded from the `Tasklet`s above. A report of mutations filtered out is printed after each file is read. |
| 81 | +* `StepExecutionListener`: Before the mutation datatype step executes, the listener will add the data loaded from the `Tasklet`s above. After the mutation datatype step executes, the listener will report the total samples loaded, total genes loaded, samples skipped, and entries skipped, as well as the total records imported into MUTATION and MUTATION_EVENT for the current datatype. |
| 82 | + |
0 commit comments