-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ena-submission): Add code to submit sequences to ENA and return …
…results to Loculus (#2417) * Add code to create project object for submission, submit to ena and keep state in database. * Create sample.xml objects to send to ENA using PHAG4E's metadata field mapping. Keep state in sample_table. Send slack notifications if submission fails. * Create assembly, add webin-cli to docker container, add call to API to check status of assembly submission. * Map submission results to external metadata fields and upload results to Loculus. * Fix external metadata upload issue in backend, add additional flyway version. * add gcaAccession field to values.yaml * use connection pooling for db requests and explicitly rollback if execute fails * Prevent SQL injection with table_name and column name validation * Update docs, add details of ena-submission to README (taking from all previous PRs). * Do not store all data from get-released-data call * Send slack notification when step fails. --------- Co-authored-by: Cornelius Roemer <[email protected]>
- Loading branch information
1 parent
048f7d9
commit d400725
Showing
32 changed files
with
3,665 additions
and
232 deletions.
There are no files selected for viewing
This file contains 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 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,37 @@ | ||
name: ena-submission-tests | ||
on: | ||
# test | ||
pull_request: | ||
paths: | ||
- "ena-submission/**" | ||
- ".github/workflows/ena-submission-tests.yml" | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
concurrency: | ||
group: ci-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}-ena-submission-tests | ||
cancel-in-progress: true | ||
jobs: | ||
unitTests: | ||
name: Unit Tests | ||
runs-on: codebuild-loculus-ci-${{ github.run_id }}-${{ github.run_attempt }} | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: ena-submission/environment.yml | ||
micromamba-version: 'latest' | ||
init-shell: >- | ||
bash | ||
powershell | ||
cache-environment: true | ||
post-cleanup: 'all' | ||
- name: Run tests | ||
run: | | ||
micromamba activate loculus-ena-submission | ||
python3 scripts/test_ena_submission.py | ||
shell: micromamba-shell {0} | ||
working-directory: ena-submission |
This file contains 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
46 changes: 46 additions & 0 deletions
46
backend/src/main/resources/db/migration/V1.3__update_view.sql
This file contains 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,46 @@ | ||
drop view if exists external_metadata_view cascade; | ||
|
||
create view external_metadata_view as | ||
select | ||
sequence_entries_preprocessed_data.accession, | ||
sequence_entries_preprocessed_data.version, | ||
all_external_metadata.updated_metadata_at, | ||
-- || concatenates two JSON objects by generating an object containing the union of their keys | ||
-- taking the second object's value when there are duplicate keys. | ||
case | ||
when all_external_metadata.external_metadata is null then jsonb_build_object('metadata', (sequence_entries_preprocessed_data.processed_data->'metadata')) | ||
else jsonb_build_object('metadata', (sequence_entries_preprocessed_data.processed_data->'metadata') || all_external_metadata.external_metadata) | ||
end as joint_metadata | ||
from | ||
sequence_entries_preprocessed_data | ||
left join all_external_metadata on | ||
all_external_metadata.accession = sequence_entries_preprocessed_data.accession | ||
and all_external_metadata.version = sequence_entries_preprocessed_data.version | ||
and sequence_entries_preprocessed_data.pipeline_version = (select version from current_processing_pipeline); | ||
|
||
create view sequence_entries_view as | ||
select | ||
se.*, | ||
sepd.started_processing_at, | ||
sepd.finished_processing_at, | ||
sepd.processed_data as processed_data, | ||
sepd.processed_data || em.joint_metadata as joint_metadata, | ||
sepd.errors, | ||
sepd.warnings, | ||
case | ||
when se.released_at is not null then 'APPROVED_FOR_RELEASE' | ||
when se.is_revocation then 'AWAITING_APPROVAL' | ||
when sepd.processing_status = 'IN_PROCESSING' then 'IN_PROCESSING' | ||
when sepd.processing_status = 'HAS_ERRORS' then 'HAS_ERRORS' | ||
when sepd.processing_status = 'FINISHED' then 'AWAITING_APPROVAL' | ||
else 'RECEIVED' | ||
end as status | ||
from | ||
sequence_entries se | ||
left join sequence_entries_preprocessed_data sepd on | ||
se.accession = sepd.accession | ||
and se.version = sepd.version | ||
and sepd.pipeline_version = (select version from current_processing_pipeline) | ||
left join external_metadata_view em on | ||
se.accession = em.accession | ||
and se.version = em.version; |
This file contains 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 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 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.