Skip to content

Commit

Permalink
feat(website/prepro): Let the insdc_ingest_user submit data with miss…
Browse files Browse the repository at this point in the history
…ing required fields. (#2281)
  • Loading branch information
anna-parker authored Jul 10, 2024
1 parent 05b7443 commit a02a8fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __hash__(self):

@dataclass
class UnprocessedData:
submitter: str
metadata: InputMetadata
unalignedNucleotideSequences: dict[str, NucleotideSequence]

Expand Down
8 changes: 7 additions & 1 deletion preprocessing/nextclade/src/loculus_preprocessing/prepro.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def parse_ndjson(ndjson_data: str) -> Sequence[UnprocessedEntry]:
json_str_processed = json_str.replace("\N{NO-BREAK SPACE}", " ")
json_object = json.loads(json_str_processed)
unprocessed_data = UnprocessedData(
submitter=json_object["submitter"],
metadata=json_object["data"]["metadata"],
unalignedNucleotideSequences=json_object["data"]["unalignedNucleotideSequences"],
)
Expand Down Expand Up @@ -157,6 +158,7 @@ def enrich_with_nextclade(
for entry in unprocessed:
id = entry.accessionVersion
input_metadata[id] = entry.data.metadata
input_metadata[id]["submitter"] = entry.data.submitter
aligned_aminoacid_sequences[id] = {}
unaligned_nucleotide_sequences[id] = {}
aligned_nucleotide_sequences[id] = {}
Expand Down Expand Up @@ -513,7 +515,11 @@ def process_single(
)
output_metadata[output_field] = processing_result.datum
# TODO(#2249): Do not throw an error if the submitter is insdc_ingest_user.
if null_per_backend(processing_result.datum) and spec.required:
if (
null_per_backend(processing_result.datum)
and spec.required
and unprocessed.inputMetadata["submitter"] != "insdc_ingest_user"
):
errors.append(
ProcessingAnnotation(
source=[
Expand Down

0 comments on commit a02a8fc

Please sign in to comment.