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

[AG-1385] Fixes JSON Schema expectation passing when it should fail #131

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

BWMac
Copy link
Contributor

@BWMac BWMac commented Apr 24, 2024

Problem:

The expect_column_values_to_match_json_schema expectation was not correctly failing when members of the go_terms list in the gene_biodomains field were not all unique. After investigation, I determined that this was due to the uniqueItems JSON Schema property not being applied correctly in our gene_biodomains JSON Schema file.

Solution:

Fix the application of the property so that it works as intended.

Testing:

In order to ensure that the expectation and therefore the data pipeline is failing when we expect, I created an invalid genes_biodomains.json file with non-unique go_terms and ran the pipeline with these changes applied. The processing error was raised as expected.

Bad JSON I used for testing:

{
    "ensembl_gene_id": "ENSG00000000003",
    "gene_biodomains": [
      {
        "biodomain": "Apoptosis",
        "go_terms": [
          "positive regulation of canonical NF-kappaB signal transduction",
          "negative regulation of non-canonical NF-kappaB signal transduction",
          "negative regulation of non-canonical NF-kappaB signal transduction" // Repeated `go_term`
        ],
        "n_biodomain_terms": 194,
        "n_gene_biodomain_terms": 2,
        "pct_linking_terms": 100.0
      }
    ]
  }

Error received:

agoradatatools.errors.ADTDataProcessingError: 
Data Processing has failed for one or more data sources. Refer to the list of errors below to address issues:
genes_biodomains: Great Expectations data validation has failed: gene_biodomains has failed expectations expect_column_values_to_match_json_schema

Copy link

sonarcloud bot commented Apr 24, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

"type": "string"
},
"maxItems": 100,
"minItems": 1,
"type": "array"
"type": "array",
"uniqueItems": true
Copy link
Member

Choose a reason for hiding this comment

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

👀 tricky...

@BWMac BWMac marked this pull request as ready for review April 25, 2024 20:24
Copy link
Member

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

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

🔥 LGTM!

Copy link
Contributor

@jaclynbeck-sage jaclynbeck-sage left a comment

Choose a reason for hiding this comment

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

Good catch! Looks good to me.

Copy link
Contributor

@JessterB JessterB left a comment

Choose a reason for hiding this comment

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

Sometimes it's the little things... ;)

@BWMac BWMac merged commit 13fa417 into dev Apr 29, 2024
9 checks passed
@BWMac BWMac deleted the bwmac/ag-1385/json_schema_bug branch April 29, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants