You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-11Lines changed: 22 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,8 @@ Invalid fields: [''] in rows: [3]
64
64
IntValidator failed 5 time(s) (100.0%) on field: 'Pierraille surface (25)'
65
65
```
66
66
67
+
When calling validate() (from python), you can access a list of logs with the 'logs' parameter of the Checkcel/Checkxtractor/Checkerator class
68
+
67
69
# Python library
68
70
69
71
```python
@@ -104,20 +106,13 @@ Validation templates can use three formats: json/yaml, and python files.
104
106
In all cases, you will need to at least include a list of validators and associated column names. Several optional parameters are also available :
105
107
106
108
**metadata*: A list of column names. This will create a metadata sheet with these columns, without validation on them
109
+
**expected_rows*: (Default 0): Number of *data* rows expected
107
110
**empty_ok* (Default False): Whether to accept empty values as valid
108
-
**empty_ok_if* (Default None): Accept empty value as valid if **another column** value is set
109
-
* Accept either a string (column name), a list (list of column names), or a dict
110
-
* The dict keys must be column names, and the values lists of 'accepted values'. The current column will accept empty values if the related column's value is in the list of accepted values
111
-
**empty_ok_unless* (Default None): Accept empty value as valid *unless***another column** value is set
112
-
* Accept either a string (column name), a list (list of column names), or a dict
113
-
* The dict keys must be column names, and the values lists of 'rejected values'. The current column will accept empty values if the related column's value is **not** in the list of reject values
114
111
**ignore_space* (Default False): whether to trim the values for spaces before checking validity
115
112
**ignore_case* (Default False): whether to ignore the case
116
-
**readme* (Default None): Additional information to include on the readme page
117
113
118
114
The last 3 parameters will affect all the validators (when relevant), but can be overriden at the validator level (eg, you can set 'empty_ok' to True for all, but set it to False for a specific validator).
119
115
120
-
121
116
## Python format
122
117
123
118
A template needs to contain a class inheriting the Checkplate class.
@@ -147,13 +142,29 @@ If needed, these dictionnaries can include an 'options' key, containing a dictio
147
142
148
143
## Validators
149
144
150
-
All validators (except NoValidator) have the 'empty_ok' option, which will consider empty values as valid.
151
-
*As in-file validation for non-empty values is unreliable, the non-emptyness is not checked in-file*
145
+
### Global options
146
+
147
+
All validators (except NoValidator) have these options available. If relevant, these options will override the ones set at the template-level
148
+
149
+
**empty_ok* (Default False): Whether to accept empty values as valid (Not enforced in excel)
150
+
**empty_ok_if* (Default None): Accept empty value as valid if **another column** value is set
151
+
* Accept either a string (column name), a list (list of column names), or a dict (Not enforced in excel)
152
+
* The dict keys must be column names, and the values lists of 'accepted values'. The current column will accept empty values if the related column's value is in the list of accepted values
153
+
**empty_ok_unless* (Default None): Accept empty value as valid *unless***another column** value is set. (Not enforced in excel)
154
+
* Accept either a string (column name), a list (list of column names), or a dict
155
+
* The dict keys must be column names, and the values lists of 'rejected values'. The current column will accept empty values if the related column's value is **not** in the list of reject values
156
+
**ignore_space* (Default False): whether to trim the values for spaces before checking validity
157
+
**ignore_case* (Default False): whether to ignore the case
158
+
**unique* (Default False): whether to enforce unicity for this column. (Not enforced in excel yet, except if there are not other validation (ie TextValidator and RegexValidator in some cases))
159
+
160
+
*As excel validation for non-empty values is unreliable, the non-emptiness cannot be properly enforced in excel files*
161
+
162
+
### Validator-specific options
152
163
153
164
* NoValidator (always True)
154
165
***No in-file validation generated**
155
166
* TextValidator(empty_ok=False)
156
-
***No in-file validation generated**
167
+
***No in-file validation generated** (unless *unique* is set)
0 commit comments