Skip to content

Commit

Permalink
release v0.6 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
zargot authored Dec 3, 2024
2 parents c4d185d + 873bf8c commit bed697f
Show file tree
Hide file tree
Showing 57 changed files with 2,099 additions and 2,432 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt
- run: pip install -r tools/requirements.txt
- run: pip install -r tests/requirements.txt
- run: pip install .
- run: python -m unittest discover tests
4 changes: 3 additions & 1 deletion .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- uses: nikeee/setup-pandoc@v1
- uses: quarto-dev/quarto-actions/setup@v2.0.3
- uses: actions/checkout@v3
Expand All @@ -25,7 +27,7 @@ jobs:
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Render Quarto docs
run: python tools/render_quarto_docs.py
run: python src/odm_validation/tools/render_quarto_docs.py
- name: Build and Commit
uses: sphinx-notes/pages@2.1 # requires checkout with `fetch-depth: 0`
with:
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# temporary
__pycache__/
# temp dirs
__pycache__

# temp files
*.log

# python `venv`
.venv/
/.env/

# python `pyenv`
.python-version
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## [0.6.0] - 2024-12-02

### General

- Added CLI command `odm-validate`
- Fixed documentation generation
- Fixed issue where empty values triggered rules "less-than-min-length" and
"invalid_category"
- Fixed json serialization of summarized report
- Fixed misc bugs and errors

### API

- Added verbosity parameter to `_validate_data_ext`

### Validation schemas

- Added `anyof` with `empty` for fields with `allowed` or `minlength`
- Fixed boolean-set values

#### v2.0.0

- Removed tables:
- languages
- parts
- sets
- translations

## [0.5.0] - 2024-01-03

### General
Expand Down
8 changes: 5 additions & 3 deletions assets/specs/module-functions/schema-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ schema:
schema:
SiteID:
required: true
allowed:
- Ottawa Site
- Montreal Site
anyof:
- allowed:
- Ottawa Site
- Montreal Site
empty: true
meta:
- ruleID: missing_mandatory_column
meta:
Expand Down
14 changes: 8 additions & 6 deletions assets/specs/module-functions/schema-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ schema:
type: dict
schema:
collection:
allowed:
- comp3h
- comp8h
- flowPr
- comp3
- comp3dep
anyof:
- allowed:
- comp3h
- comp8h
- flowPr
- comp3
- comp3dep
empty: true
meta:
- ruleID: invalid_category
meta:
Expand Down
7 changes: 6 additions & 1 deletion assets/specs/module-functions/schema-additions-1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"Site": {
"SiteID": {
"allowed": ["Ottawa Site", "Montreal Site"]
"anyof": [
{
"allowed": ["Ottawa Site", "Montreal Site"],
"empty": true
}
]
}
}
}
6 changes: 5 additions & 1 deletion assets/specs/module-functions/schema-additions-2.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"samples": {
"collection": {
"allowed": ["comp3", "comp3dep"]
"anyof": [
{
"allowed": ["comp3", "comp3dep"]
}
]
}
}
}
6 changes: 6 additions & 0 deletions assets/validation-rules/empty/dataset-allowed.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
siteID,allowedField
1,
2,""
3," "
4,NA
5,a
7 changes: 7 additions & 0 deletions assets/validation-rules/empty/dataset-minlength.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
siteID,minlengthField
1,
2,""
3," "
4,NA
5,x
6,xxxxx
66 changes: 66 additions & 0 deletions assets/validation-rules/empty/error-report-allowed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"warnings": [
{
"columnName": "allowedField",
"invalidValue": "",
"message": "missing_values_found rule triggered in table sites, column allowedField, row(s) 1: Empty string found",
"row": {"allowedField": "", "siteID": "1"},
"rowNumber": 1,
"tableName": "sites",
"validationRuleFields": [],
"warningType": "missing_values_found"
},
{
"columnName": "allowedField",
"invalidValue": "",
"message": "missing_values_found rule triggered in table sites, column allowedField, row(s) 2: Empty string found",
"row": {"allowedField": "", "siteID": "2"},
"rowNumber": 2,
"tableName": "sites",
"validationRuleFields": [],
"warningType": "missing_values_found"
},
{
"columnName": "allowedField",
"invalidValue": " ",
"message": "missing_values_found rule triggered in table sites, column allowedField, row(s) 3: Missing value \" \"",
"row": {"allowedField": " ", "siteID": "3"},
"rowNumber": 3,
"tableName": "sites",
"validationRuleFields": [],
"warningType": "missing_values_found"
},
{
"columnName": "allowedField",
"invalidValue": "NA",
"message": "missing_values_found rule triggered in table sites, column allowedField, row(s) 4: Missing value \"NA\"",
"row": {"allowedField": "NA", "siteID": "4"},
"rowNumber": 4,
"tableName": "sites",
"validationRuleFields": [],
"warningType": "missing_values_found"
}
],
"errors": [
{
"columnName": "allowedField",
"errorType": "invalid_category",
"invalidValue": " ",
"message": "invalid_category rule violated in table sites, column allowedField, row(s) 3: Invalid category \" \"",
"row": {"allowedField": " ", "siteID": "3"},
"rowNumber": 3,
"tableName": "sites",
"validationRuleFields": []
},
{
"columnName": "allowedField",
"errorType": "invalid_category",
"invalidValue": "NA",
"message": "invalid_category rule violated in table sites, column allowedField, row(s) 4: Invalid category \"NA\"",
"row": {"allowedField": "NA", "siteID": "4"},
"rowNumber": 4,
"tableName": "sites",
"validationRuleFields": []
}
]
}
75 changes: 75 additions & 0 deletions assets/validation-rules/empty/error-report-minlength.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"warnings": [
{
"warningType": "missing_values_found",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "missing_values_found rule triggered in table sites, column minlengthField, row(s) 1: Empty string found",
"rowNumber": 1,
"row": {"siteID": "1", "minlengthField": ""},
"invalidValue": ""
},
{
"warningType": "missing_values_found",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "missing_values_found rule triggered in table sites, column minlengthField, row(s) 2: Empty string found",
"rowNumber": 2,
"row": {"siteID": "2", "minlengthField": ""}, "invalidValue": ""
},
{
"warningType": "missing_values_found",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "missing_values_found rule triggered in table sites, column minlengthField, row(s) 3: Missing value \" \"",
"rowNumber": 3,
"row": {"siteID": "3", "minlengthField": " "},
"invalidValue": " "
},
{
"warningType": "missing_values_found",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "missing_values_found rule triggered in table sites, column minlengthField, row(s) 4: Missing value \"NA\"",
"rowNumber": 4,
"row": {"siteID": "4", "minlengthField": "NA"},
"invalidValue": "NA"
}
],
"errors": [
{
"errorType": "less_than_min_length",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "less_than_min_length rule violated in table sites, column minlengthField, row(s) 3: Value \" \" (of length 3) is less than the min length of \"5\"",
"rowNumber": 3,
"row": {"siteID": "3", "minlengthField": " "},
"invalidValue": " "
},
{
"errorType": "less_than_min_length",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "less_than_min_length rule violated in table sites, column minlengthField, row(s) 4: Value \"NA\" (of length 2) is less than the min length of \"5\"",
"rowNumber": 4,
"row": {"siteID": "4", "minlengthField": "NA"},
"invalidValue": "NA"
},
{
"errorType": "less_than_min_length",
"tableName": "sites",
"columnName": "minlengthField",
"validationRuleFields": [],
"message": "less_than_min_length rule violated in table sites, column minlengthField, row(s) 5: Value \"x\" (of length 1) is less than the min length of \"5\"",
"rowNumber" : 5,
"row": {"siteID": "5", "minlengthField": "x"},
"invalidValue": "x"
}
]
}
16 changes: 16 additions & 0 deletions assets/validation-rules/empty/schema-v2-allowed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
schemaVersion: 2.0.0
schema:
sites:
type: list
schema:
type: dict
schema:
allowedField:
anyof:
- allowed:
- a
- b
empty: true
emptyTrimmed: false
forbidden:
- NA
14 changes: 14 additions & 0 deletions assets/validation-rules/empty/schema-v2-minlength.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schemaVersion: 2.0.0
schema:
sites:
type: list
schema:
type: dict
schema:
minlengthField:
anyof:
- minlength: 5
empty: true
emptyTrimmed: false
forbidden:
- NA
28 changes: 17 additions & 11 deletions assets/validation-rules/invalid-category/schema-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ schema:
type: dict
schema:
Collection:
allowed:
- Comp3h
- Comp8h
- FlowPr
- FlowRatePr
- other
anyof:
- allowed:
- Comp3h
- Comp8h
- FlowPr
- FlowRatePr
- other
empty: true
meta:
- ruleID: invalid_category
meta:
Expand Down Expand Up @@ -47,11 +49,13 @@ schema:
type: dict
schema:
type:
allowed:
anyof:
- allowed:
- other
- someOldCat1
- wwtpMuC
- wwtpMuS
empty: true
meta:
- ruleID: invalid_category
meta:
Expand Down Expand Up @@ -86,10 +90,12 @@ schema:
type: dict
schema:
type:
allowed:
- other
- wqCOD
- wwCOD
anyof:
- allowed:
- other
- wqCOD
- wwCOD
empty: true
meta:
- ruleID: invalid_category
meta:
Expand Down
10 changes: 6 additions & 4 deletions assets/validation-rules/invalid-category/schema-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ schema:
type: dict
schema:
coll:
allowed:
- comp3h
- comp8h
- flowPr
anyof:
- allowed:
- comp3h
- comp8h
- flowPr
empty: True
meta:
- ruleID: invalid_category
meta:
Expand Down
Loading

0 comments on commit bed697f

Please sign in to comment.