-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rules): WRONG_ENTITY_IS_HEADER, NON_CONCEPT_HEADER and WRONG_ENT…
- Loading branch information
Showing
24 changed files
with
500 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# NON_CONCEPT_HEADER | ||
|
||
## Rule test folder | ||
|
||
`test/fixtures/rules-cases/non-concept-header` | ||
|
||
## Description | ||
Each part of any header should be concept (is-- fields are excluded in this case) | ||
|
||
## Examples of correct data | ||
|
||
ddf--concepts.csv | ||
``` | ||
concept,concept_type,domain,name | ||
name,string,, | ||
geo,entity_domain,, | ||
country,entity_set,geo,Country | ||
pop,measure,geo,Population | ||
year,time,,year | ||
``` | ||
|
||
ddf--datapoints--pop--by--country--year.csv | ||
``` | ||
country,year,pop | ||
vat,1960,100000 | ||
``` | ||
|
||
## Examples of incorrect data | ||
|
||
ddf--concepts.csv | ||
``` | ||
concept,concept_type,domain,name | ||
name,string,, | ||
geo,entity_domain,, | ||
country,entity_set,geo,Country | ||
pop,measure,geo,Population | ||
year,time,,year | ||
``` | ||
|
||
ddf--datapoints--pop--by--country--year.csv | ||
``` | ||
countryFOO,year,pop | ||
vat,1960,100000 | ||
``` | ||
|
||
## Output data format | ||
|
||
Should be included next information: | ||
|
||
incorrect header value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# WRONG_ENTITY_IS_HEADER | ||
|
||
## Rule test folder | ||
|
||
`test/fixtures/rules-cases/wrong-entity-is-header` | ||
|
||
## Description | ||
An issue according to this rule will be fired when `is-header` in concept is defined and not valid: not a concept with `entity_set` type | ||
|
||
## Examples of correct data | ||
|
||
`ddf--concepts.csv` | ||
``` | ||
"concept","name","concept_type","domain", | ||
"income_groups","Income groups","entity_set","geo", | ||
"geo","Geographic location","entity_domain",, | ||
``` | ||
and | ||
`ddf--entities--geo--income_groups.csv` | ||
``` | ||
income_groups,name,gwid,is--income_groups | ||
high_income,High income,i268,TRUE | ||
lower_middle_income,Lower middle income,i269,TRUE | ||
low_income,Low income,i266,TRUE | ||
upper_middle_income,Upper middle income,i267,TRUE | ||
``` | ||
|
||
## Examples of incorrect data | ||
|
||
`ddf--concepts.csv` | ||
``` | ||
"concept","name","concept_type","domain", | ||
"income_groups","Income groups","entity_set","geo", | ||
"geo","Geographic location","entity_domain",, | ||
``` | ||
and | ||
`ddf--entities--geo--income_groups.csv` | ||
``` | ||
income_groups,name,gwid,is--foo_groups | ||
high_income,High income,i268,TRUE | ||
lower_middle_income,Lower middle income,i269,TRUE | ||
low_income,Low income,i266,TRUE | ||
upper_middle_income,Upper middle income,i267,TRUE | ||
``` | ||
|
||
## Output data format | ||
|
||
* `message` - kind of issue. It should be `Not a concept` or `Wrong concept type` | ||
* `header name` - csv's column name | ||
|
||
### Additional information | ||
|
||
is--header is not mandatory anywhere, absence just means all entities have value false for that is--header. | ||
|
||
only error when: `is--xxx` is used when `xxx` is not defined in concepts as an entity_set. No other case should give an error. | ||
|
||
So the following is also valid (though the `is--country` is nonsensical): | ||
`ddf--concepts.csv` | ||
``` | ||
"concept","name","concept_type","domain", | ||
"income_groups","Income groups","entity_set","geo", | ||
"geo","Geographic location","entity_domain",, | ||
"country","Country","entity_set","geo" | ||
``` | ||
`incomegroups.csv` | ||
``` | ||
income_groups,name,gwid,is--income_groups,is--country | ||
high_income,High income,i268,TRUE,FALSE | ||
lower_middle_income,Lower middle income,i269,TRUE,FALSE | ||
low_income,Low income,i266,TRUE,TRUE | ||
upper_middle_income,Upper middle income,i267,TRUE,TRUE | ||
``` | ||
`ddf--index.csv` | ||
``` | ||
"key","value","file" | ||
"income_groups","name","incomegroups.csv" | ||
"income_groups","gwid","incomegroups.csv" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# WRONG_ENTITY_IS_VALUE` | ||
|
||
## Rule test folder | ||
|
||
`test/fixtures/rules-cases/wrong-entity-is-value` | ||
|
||
## Description | ||
An issue according to this rule will be fired when value under `is-` header doesn't look like boolean | ||
|
||
## Examples of correct data | ||
|
||
`ddf--entities--geo--income_groups.csv` | ||
``` | ||
income_groups,name,gwid,is--income_groups | ||
high_income,High income,i268,TRUE | ||
lower_middle_income,Lower middle income,i269,TRUE | ||
low_income,Low income,i266,TRUE | ||
upper_middle_income,Upper middle income,i267,TRUE | ||
``` | ||
|
||
## Examples of incorrect data | ||
|
||
`ddf--entities--geo--income_groups.csv` | ||
``` | ||
income_groups,name,gwid,is--income_groups | ||
high_income,High income,i268,FOO | ||
``` | ||
|
||
## Output data format | ||
|
||
* `header name` - csv's column name | ||
* `header value` | ||
* `line in csv` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.