Skip to content

Commit

Permalink
URL checks error reformatting (#1315)
Browse files Browse the repository at this point in the history
* reformatted _url_checks method to use _get_message, removed unnecessary nesting in validation output
  • Loading branch information
gesinaphillips authored Mar 25, 2024
1 parent 2ca4e4c commit dc04852
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Ported murine from SenNet
- Update Histology directory schema
- Bugfix stripping trailing slash in ingest api url
- Converted upload `_url_checks` to use `_get_method` for SenNet compatibility

## v0.0.17

Expand Down
27 changes: 13 additions & 14 deletions examples/dataset-examples/bad-cedar-assay-histology/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@ Upload Errors:
column 'contributors_path', value './contributors.tsv'
: CEDAR Validation Errors:
examples/dataset-examples/bad-cedar-assay-histology/upload/contributors.tsv:
examples/dataset-examples/bad-cedar-assay-histology/upload/contributors.tsv:
- Validation Errors:
- On row 0, column "orcid", value "0000-0002-8928-abcd" fails because
of error "invalidValueFormat".
Validation Errors:
- On row 0, column "orcid", value "0000-0002-8928-abcd" fails because of
error "invalidValueFormat".
Metadata TSV Validation Errors:
CEDAR Validation Errors:
examples/dataset-examples/bad-cedar-assay-histology/upload/bad-histology-metadata.tsv:
examples/dataset-examples/bad-cedar-assay-histology/upload/bad-histology-metadata.tsv:
- URL Errors:
- 'Row 2, field "parent_sample_id" with value "wrong": Field value is not
valid; URL https://entity.api.hubmapconsortium.org/entities/wrong returned
a 400 Error.'
Validation Errors:
- On row 0, column "parent_sample_id", value "wrong" fails because of error
"invalidValueFormat".
- On row 1, column "contributors_path", value "" fails because of error "missingRequired".
URL Errors:
- 'On row 2, column "parent_sample_id", value "wrong" fails because of error
"HTTPError": 401 Client Error: Unauthorized for url: https://entity.api.hubmapconsortium.org/entities/wrong.'
- 'On row 3, column "parent_sample_id", value "HBM854.FXDQ.783" fails because
of error "HTTPError": 401 Client Error: Unauthorized for url: https://entity.api.hubmapconsortium.org/entities/HBM854.FXDQ.783'
Validation Errors:
- On row 0, column "parent_sample_id", value "wrong" fails because of error
"invalidValueFormat".
- On row 1, column "contributors_path", value "" fails because of error "missingRequired".
Reference Errors:
No References:
Files:
- unreferenced_file.
Hint: 'If validation fails because of extra whitespace in the TSV, try:
src/cleanup_whitespace.py --tsv_in original.tsv --tsv_out clean.tsv.'
```
```
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {"h-and-e": {"examples/dataset-examples/bad-cedar-assay-histology/upload/bad-histology-metadata.tsv": [{"URL Errors": ["Row 2, field 'parent_sample_id' with value 'wrong': 400 Client Error: Bad Request for url: https://entity.api.hubmapconsortium.org/entities/wrong"], "Validation Errors": ["On row 0, column \"parent_sample_id\", value \"wrong\" fails because of error \"invalidValueFormat\"", "On row 1, column \"contributors_path\", value \"\" fails because of error \"missingRequired\""]}]}, "contributors": {"examples/dataset-examples/bad-cedar-assay-histology/upload/contributors.tsv": [{"Validation Errors": ["On row 0, column \"orcid\", value \"0000-0002-8928-abcd\" fails because of error \"invalidValueFormat\""]}]}}}
{"assaytype": {"Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {"h-and-e": {"URL Errors": ["On row 2, column \"parent_sample_id\", value \"wrong\" fails because of error \"HTTPError\": 400 Client Error: Bad Request for url: https://entity.api.hubmapconsortium.org/entities/wrong"], "Validation Errors": ["On row 0, column \"parent_sample_id\", value \"wrong\" fails because of error \"invalidValueFormat\"", "On row 1, column \"contributors_path\", value \"\" fails because of error \"missingRequired\""]}, "contributors": {"Validation Errors": ["On row 0, column \"orcid\", value \"0000-0002-8928-abcd\" fails because of error \"invalidValueFormat\""]}}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
Metadata TSV Validation Errors:
CEDAR Validation Errors:
examples/dataset-examples/bad-cedar-multi-assay-visium-bad-child-metadata/upload/bad-visium-rnaseq-metadata.tsv:
examples/dataset-examples/bad-cedar-multi-assay-visium-bad-child-metadata/upload/bad-visium-rnaseq-metadata.tsv:
- URL Errors:
- 'Row 3, field "parent_sample_id" with value "": 404 Client Error: Not Found
for url: https://entity.api.hubmapconsortium.org/entities/.'
Validation Errors:
- On row 1, column "parent_sample_id", value "" fails because of error "missingRequired".
- On row 2, column "preparation_protocol_doi", value "wrong" fails because
of error "invalidUrl".
URL Errors:
- 'On row 3, column "parent_sample_id", value "" fails because of error "HTTPError":
404 Client Error: Not Found for url: https://entity.api.hubmapconsortium.org/entities/.'
Validation Errors:
- On row 1, column "parent_sample_id", value "" fails because of error "missingRequired".
- On row 2, column "preparation_protocol_doi", value "wrong" fails because of
error "invalidUrl".
Reference Errors:
No References:
Files:
- unreferenced_file.
Hint: 'If validation fails because of extra whitespace in the TSV, try:
src/cleanup_whitespace.py --tsv_in original.tsv --tsv_out clean.tsv.'
```
```
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}, "Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {"scRNAseq-10Genomics-v3": {"examples/dataset-examples/bad-cedar-multi-assay-visium-bad-child-metadata/upload/bad-visium-rnaseq-metadata.tsv": [{"URL Errors": ["Row 3, field 'parent_sample_id' with value '': 404 Client Error: Not Found for url: https://entity.api.hubmapconsortium.org/entities/"], "Validation Errors": ["On row 1, column \"parent_sample_id\", value \"\" fails because of error \"missingRequired\"", "On row 2, column \"preparation_protocol_doi\", value \"wrong\" fails because of error \"invalidUrl\""]}]}, "contributors": null, "visium-no-probes": null, "h-and-e": null}}
{"assaytype": {"RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}, "Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {"scRNAseq-10xGenomics-v3": {"URL Errors": ["On row 3, column \"parent_sample_id\", value \"\" fails because of error \"HTTPError\": 404 Client Error: Not Found for url: https://entity.api.hubmapconsortium.org/entities/"], "Validation Errors": ["On row 1, column \"parent_sample_id\", value \"\" fails because of error \"missingRequired\"", "On row 2, column \"preparation_protocol_doi\", value \"wrong\" fails because of error \"invalidUrl\""]}, "contributors": null, "visium-no-probes": null, "h-and-e": null}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10Genomics-v3": null}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10xGenomics-v3": null}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"RNAseq (with probes)": {"assaytype": "scRNAseq-visium-with-probes", "contains-pii": true, "dataset-type": "RNAseq (with probes)", "description": "Visium RNAseq with probes", "dir-schema": "rnaseq-with-probes-v2", "primary": true, "vitessce-hints": []}, "Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
{"assaytype": {"RNAseq (with probes)": {"assaytype": "scRNAseq-visium-with-probes", "contains-pii": true, "dataset-type": "RNAseq (with probes)", "description": "Visium RNAseq with probes", "dir-schema": "rnaseq-with-probes-v2", "primary": true, "vitessce-hints": []}, "Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}}, "validation": {}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TSVs:
Metadata schema version: '2'
Directory schema versions: histology-v2
good-visium-rnaseq-metadata.tsv:
Schema: scRNAseq-10Genomics-v3-v2
Schema: scRNAseq-10xGenomics-v3-v2
Metadata schema version: '2'
Directory schema versions: rnaseq-v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10Genomics-v3": null}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10xGenomics-v3": null}}
2 changes: 1 addition & 1 deletion examples/plugin-tests/expected-failure/fixtures.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (No probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10Genomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10Genomics-v3": null}}
{"assaytype": {"Visium (no probes)": {"assaytype": "visium-no-probes", "contains-pii": true, "dataset-type": "Visium (no probes)", "description": "Visium (no probes)", "dir-schema": "visium-no-probes-v2", "is-multi-assay": true, "must-contain": ["Histology", "RNAseq"], "primary": true, "vitessce-hints": []}, "Histology": {"assaytype": "h-and-e", "contains-pii": false, "dataset-type": "Histology", "description": "H&E Stained Microscopy", "dir-schema": "histology-v2", "primary": true, "vitessce-hints": []}, "RNAseq": {"assaytype": "scRNAseq-10xGenomics-v3", "contains-pii": true, "dataset-type": "RNAseq", "description": "scRNA-seq (10x Genomics v3)", "dir-schema": "rnaseq-v2", "primary": true, "vitessce-hints": []}}, "validation": {"visium-no-probes": null, "contributors": null, "h-and-e": null, "scRNAseq-10xGenomics-v3": null}}
Loading

0 comments on commit dc04852

Please sign in to comment.