Skip to content

Commit

Permalink
#382 validation pattern for fire
Browse files Browse the repository at this point in the history
  • Loading branch information
turbomam committed Jan 24, 2023
1 parent c32bf05 commit aecbabc
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,17 @@ SCHEMA_TEST_EXAMPLES := \
nmdc_example_database \
samp_prep_db \
study_credit_test \
study_test
study_test \
minimal_valid_biosample_with_fire

SCHEMA_TEST_EXAMPLES_INVALID := \
biosample_invalid_range \
biosample_mismatch_regex \
biosample_missing_required_field \
biosample_single_multi_value_mixup \
biosample_undeclared_slot \
study_credit_enum_mangle
study_credit_enum_mangle \
minimal_biosample_invalid_fire

# functional_annotation_set_invalid has invalid ID pattern but regex tests aren't applied yet? MAM 2021-06-24

Expand Down
1 change: 1 addition & 0 deletions src/schema/nmdc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ classes:
tag: expected_value
value: date string
range: string
pattern: ^[12]\d{3}(?:(?:-(?:0[1-9]|1[0-2]))(?:-(?:0[1-9]|[12]\d|3[01]))?)?(\s+to\s+[12]\d{3}(?:(?:-(?:0[1-9]|1[0-2]))(?:-(?:0[1-9]|[12]\d|3[01]))?)?)?$
flooding:
annotations:
expected_value:
Expand Down
29 changes: 29 additions & 0 deletions test/data/invalid_data/minimal_biosample_invalid_fire.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"biosample_set": [
{
"id": "nmdc:bsm-99-dtTMNb",
"fire": "like a volcano",
"part_of": [
"gold:Gs0110115"
],
"env_broad_scale": {
"has_raw_value": "ENVO:00002030",
"term": {
"id": "ENVO:00002030"
}
},
"env_local_scale": {
"has_raw_value": "ENVO:00002169",
"term": {
"id": "ENVO:00002169"
}
},
"env_medium": {
"has_raw_value": "ENVO:00005792",
"term": {
"id": "ENVO:00005792"
}
}
}
]
}
29 changes: 29 additions & 0 deletions test/data/invalid_data/minimal_biosample_with_fire_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"biosample_set": [
{
"id": "nmdc:bsm-99-dtTMNb",
"fire": "1871-10-01 to 1871-10-31",
"part_of": [
"gold:Gs0110115"
],
"env_broad_scale": {
"has_raw_value": "ENVO:00002030",
"term": {
"id": "ENVO:00002030"
}
},
"env_local_scale": {
"has_raw_value": "ENVO:00002169",
"term": {
"id": "ENVO:00002169"
}
},
"env_medium": {
"has_raw_value": "ENVO:00005792",
"term": {
"id": "ENVO:00005792"
}
}
}
]
}
32 changes: 32 additions & 0 deletions test/data/minimal_valid_biosample_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 20230124150223
// https://raw.githubusercontent.com/microbiomedata/nmdc-schema/main/test/data/minimal_valid_biosample_test.json

{
"biosample_set": [
{
"id": "nmdc:bsm-99-dtTMNb",
"fire": "1871-10-01 to 1871-10-31",
"part_of": [
"gold:Gs0110115"
],
"env_broad_scale": {
"has_raw_value": "ENVO:00002030",
"term": {
"id": "ENVO:00002030"
}
},
"env_local_scale": {
"has_raw_value": "ENVO:00002169",
"term": {
"id": "ENVO:00002169"
}
},
"env_medium": {
"has_raw_value": "ENVO:00005792",
"term": {
"id": "ENVO:00005792"
}
}
}
]
}
29 changes: 29 additions & 0 deletions test/data/minimal_valid_biosample_with_fire.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"biosample_set": [
{
"id": "nmdc:bsm-99-dtTMNb",
"fire": "1871-10-01 to 1871-10-31",
"part_of": [
"gold:Gs0110115"
],
"env_broad_scale": {
"has_raw_value": "ENVO:00002030",
"term": {
"id": "ENVO:00002030"
}
},
"env_local_scale": {
"has_raw_value": "ENVO:00002169",
"term": {
"id": "ENVO:00002169"
}
},
"env_medium": {
"has_raw_value": "ENVO:00005792",
"term": {
"id": "ENVO:00005792"
}
}
}
]
}

0 comments on commit aecbabc

Please sign in to comment.