Skip to content

Validation - refactor to be able to retrieve all errors rather than throw exception on 1st #706

Open
@davmlaw

Description

I would like to be able to see all the errors, rather than throw an exception on the 1st one

Say you asked to validate 'NM_000059.4(BRCA2):c.-40+1G>C'

Now, I know - but this is biology so it's full of messy data! This is an example from ClinVar submission
If you run it with strict=True it throws HGVSInvalidVariantError "Cannot validate sequence of an intronic variant"
strict = False it returns True (as it was only a warning)

I'd like to see what errors there are - In strict you can also only see 1 issue (the first that causes an exception to be thrown) and strict=False you can see none

I think it's important to separate the concept of "Wrong" and "I can't tell whether it's wrong"

Recommendation:

Add a new method which performs validation, and returns a list of results and messages, sorted by res (ie severity)
We could re-implement the existing validate using this
If you call the new method you can then examine it for the errors you care about (or display them to the user)
For strict - go through the sorted list and throw the worst one. For the warnings (eg "Cannot validate sequence of an intronic variant" I'd throw a subclass of HGVSInvalidVariantError which indicates it's not an error but rather you can't evaluate it - can then handle client code better)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestkeep aliveexempt issue from staleness checks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions