|
1 | | - |
2 | 1 | A transform configuration file is used to describe which transformations and |
3 | 2 | validations to apply to a source CSV file. This is a simple text file using YAML |
4 | 3 | format, using the same format as an .ABOUT file. |
5 | 4 |
|
6 | 5 | The attributes that can be set in a configuration file are: |
7 | 6 |
|
8 | 7 | * field_renamings: |
9 | | -An optional map of source CSV column name to target CSV new column name that |
10 | | -is used to rename CSV columns. |
| 8 | +An optional map of source CSV or JSON field name to target CSV/JSON new field name that |
| 9 | +is used to rename CSV fields. |
11 | 10 |
|
12 | | -For instance with this configuration the columns "Directory/Location" will be |
| 11 | +For instance with this configuration the fields "Directory/Location" will be |
13 | 12 | renamed to "about_resource" and "foo" to "bar": |
14 | 13 | field_renamings: |
15 | 14 | 'Directory/Location' : about_resource |
16 | 15 | foo : bar |
17 | 16 |
|
18 | 17 | The renaming is always applied first before other transforms and checks. All |
19 | | -other column names referenced below are these that exist AFTER the renamings |
20 | | -have been applied to the existing column names. |
| 18 | +other field names referenced below are these that exist AFTER the renamings |
| 19 | +have been applied to the existing field names. |
21 | 20 |
|
22 | 21 | * required_fields: |
23 | | -An optional list of required column names that must have a value, beyond the |
24 | | -standard columns names. If a source CSV does not have such a column or a row is |
25 | | -missing a value for a required column, an error is reported. |
| 22 | +An optional list of required field names that must have a value, beyond the |
| 23 | +standard fields names. If a source CSV/JSON does not have such a field or a row is |
| 24 | +missing a value for a required field, an error is reported. |
26 | 25 |
|
27 | | -For instance with this configuration an error will be reported if the columns |
| 26 | +For instance with this configuration an error will be reported if the fields |
28 | 27 | "name" and "version" are missing or if any row does not have a value set for |
29 | | -these columns: |
| 28 | +these fields: |
30 | 29 | required_fields: |
31 | 30 | - name |
32 | 31 | - version |
33 | 32 |
|
34 | 33 | * field_filters: |
35 | | -An optional list of column names that should be kept in the transformed CSV. If |
36 | | -this list is provided, all the columns from the source CSV that should be kept |
37 | | -in the target CSV must be listed be even if they are standard or required |
38 | | -columns. If this list is not provided, all source CSV columns are kept in the |
39 | | -transformed target CSV. |
40 | | - |
41 | | -For instance with this configuration the target CSV will only contains the "name" |
42 | | -and "version" columns and no other column: |
| 34 | +An optional list of field names that should be kept in the transformed CSV/JSON. If |
| 35 | +this list is provided, all the fields from the source CSV/JSON that should be kept |
| 36 | +in the target CSV/JSON must be listed be even if they are standard or required |
| 37 | +fields. If this list is not provided, all source CSV/JSON fields are kept in the |
| 38 | +transformed target CSV/JSON. |
| 39 | + |
| 40 | +For instance with this configuration the target CSV/JSON will only contains the "name" |
| 41 | +and "version" fields and no other field: |
43 | 42 | field_filters: |
44 | 43 | - name |
45 | | - - version |
46 | | - |
| 44 | + - version |
0 commit comments