Skip to content
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

Let the insdc_ingest_user submit data with missing required fields. #2281

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have also deleted the TODO. Seems to be done now ;)

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"
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether it's actually a good idea to hardcode a username here? What if someone else installs an own Loculus instance with its own Keycloak, where that ingest user has a different name?

Wouldn't it be better to configure something like a "user that may submit broken data" list per config/Helm chart to the pipeline?

):
errors.append(
ProcessingAnnotation(
source=[
Expand Down