csv-detective 0.6.7__py3-none-any.whl → 0.9.3.dev2438__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- csv_detective/__init__.py +7 -1
- csv_detective/cli.py +33 -21
- csv_detective/{detect_fields/FR → detection}/__init__.py +0 -0
- csv_detective/detection/columns.py +89 -0
- csv_detective/detection/encoding.py +29 -0
- csv_detective/detection/engine.py +46 -0
- csv_detective/detection/formats.py +156 -0
- csv_detective/detection/headers.py +28 -0
- csv_detective/detection/rows.py +18 -0
- csv_detective/detection/separator.py +44 -0
- csv_detective/detection/variables.py +97 -0
- csv_detective/explore_csv.py +151 -377
- csv_detective/format.py +67 -0
- csv_detective/formats/__init__.py +9 -0
- csv_detective/formats/adresse.py +116 -0
- csv_detective/formats/binary.py +26 -0
- csv_detective/formats/booleen.py +35 -0
- csv_detective/formats/code_commune_insee.py +26 -0
- csv_detective/formats/code_csp_insee.py +36 -0
- csv_detective/formats/code_departement.py +29 -0
- csv_detective/formats/code_fantoir.py +21 -0
- csv_detective/formats/code_import.py +17 -0
- csv_detective/formats/code_postal.py +25 -0
- csv_detective/formats/code_region.py +22 -0
- csv_detective/formats/code_rna.py +29 -0
- csv_detective/formats/code_waldec.py +17 -0
- csv_detective/formats/commune.py +27 -0
- csv_detective/formats/csp_insee.py +31 -0
- csv_detective/{detect_fields/FR/other/insee_ape700 → formats/data}/insee_ape700.txt +0 -0
- csv_detective/formats/date.py +99 -0
- csv_detective/formats/date_fr.py +22 -0
- csv_detective/formats/datetime_aware.py +45 -0
- csv_detective/formats/datetime_naive.py +48 -0
- csv_detective/formats/datetime_rfc822.py +24 -0
- csv_detective/formats/departement.py +37 -0
- csv_detective/formats/email.py +28 -0
- csv_detective/formats/float.py +29 -0
- csv_detective/formats/geojson.py +36 -0
- csv_detective/formats/insee_ape700.py +31 -0
- csv_detective/formats/insee_canton.py +28 -0
- csv_detective/formats/int.py +23 -0
- csv_detective/formats/iso_country_code_alpha2.py +30 -0
- csv_detective/formats/iso_country_code_alpha3.py +30 -0
- csv_detective/formats/iso_country_code_numeric.py +31 -0
- csv_detective/formats/jour_de_la_semaine.py +41 -0
- csv_detective/formats/json.py +20 -0
- csv_detective/formats/latitude_l93.py +48 -0
- csv_detective/formats/latitude_wgs.py +42 -0
- csv_detective/formats/latitude_wgs_fr_metropole.py +42 -0
- csv_detective/formats/latlon_wgs.py +53 -0
- csv_detective/formats/longitude_l93.py +39 -0
- csv_detective/formats/longitude_wgs.py +32 -0
- csv_detective/formats/longitude_wgs_fr_metropole.py +32 -0
- csv_detective/formats/lonlat_wgs.py +36 -0
- csv_detective/formats/mois_de_lannee.py +48 -0
- csv_detective/formats/money.py +18 -0
- csv_detective/formats/mongo_object_id.py +14 -0
- csv_detective/formats/pays.py +35 -0
- csv_detective/formats/percent.py +16 -0
- csv_detective/formats/region.py +70 -0
- csv_detective/formats/sexe.py +17 -0
- csv_detective/formats/siren.py +37 -0
- csv_detective/{detect_fields/FR/other/siret/__init__.py → formats/siret.py} +47 -29
- csv_detective/formats/tel_fr.py +36 -0
- csv_detective/formats/uai.py +36 -0
- csv_detective/formats/url.py +46 -0
- csv_detective/formats/username.py +14 -0
- csv_detective/formats/uuid.py +16 -0
- csv_detective/formats/year.py +28 -0
- csv_detective/output/__init__.py +65 -0
- csv_detective/output/dataframe.py +96 -0
- csv_detective/output/example.py +250 -0
- csv_detective/output/profile.py +119 -0
- csv_detective/{schema_generation.py → output/schema.py} +268 -343
- csv_detective/output/utils.py +74 -0
- csv_detective/{detect_fields/FR/geo → parsing}/__init__.py +0 -0
- csv_detective/parsing/columns.py +235 -0
- csv_detective/parsing/compression.py +11 -0
- csv_detective/parsing/csv.py +56 -0
- csv_detective/parsing/excel.py +167 -0
- csv_detective/parsing/load.py +111 -0
- csv_detective/parsing/text.py +56 -0
- csv_detective/utils.py +23 -196
- csv_detective/validate.py +138 -0
- csv_detective-0.9.3.dev2438.dist-info/METADATA +267 -0
- csv_detective-0.9.3.dev2438.dist-info/RECORD +92 -0
- csv_detective-0.9.3.dev2438.dist-info/WHEEL +4 -0
- {csv_detective-0.6.7.dist-info → csv_detective-0.9.3.dev2438.dist-info}/entry_points.txt +1 -0
- csv_detective/all_packages.txt +0 -104
- csv_detective/detect_fields/FR/geo/adresse/__init__.py +0 -100
- csv_detective/detect_fields/FR/geo/code_commune_insee/__init__.py +0 -24
- csv_detective/detect_fields/FR/geo/code_commune_insee/code_commune_insee.txt +0 -37600
- csv_detective/detect_fields/FR/geo/code_departement/__init__.py +0 -11
- csv_detective/detect_fields/FR/geo/code_fantoir/__init__.py +0 -15
- csv_detective/detect_fields/FR/geo/code_fantoir/code_fantoir.txt +0 -26122
- csv_detective/detect_fields/FR/geo/code_postal/__init__.py +0 -19
- csv_detective/detect_fields/FR/geo/code_postal/code_postal.txt +0 -36822
- csv_detective/detect_fields/FR/geo/code_region/__init__.py +0 -27
- csv_detective/detect_fields/FR/geo/commune/__init__.py +0 -21
- csv_detective/detect_fields/FR/geo/commune/commune.txt +0 -36745
- csv_detective/detect_fields/FR/geo/departement/__init__.py +0 -19
- csv_detective/detect_fields/FR/geo/departement/departement.txt +0 -101
- csv_detective/detect_fields/FR/geo/insee_canton/__init__.py +0 -20
- csv_detective/detect_fields/FR/geo/insee_canton/canton2017.txt +0 -2055
- csv_detective/detect_fields/FR/geo/insee_canton/cantons.txt +0 -2055
- csv_detective/detect_fields/FR/geo/latitude_l93/__init__.py +0 -13
- csv_detective/detect_fields/FR/geo/latitude_wgs_fr_metropole/__init__.py +0 -13
- csv_detective/detect_fields/FR/geo/longitude_l93/__init__.py +0 -13
- csv_detective/detect_fields/FR/geo/longitude_wgs_fr_metropole/__init__.py +0 -13
- csv_detective/detect_fields/FR/geo/pays/__init__.py +0 -17
- csv_detective/detect_fields/FR/geo/pays/pays.txt +0 -248
- csv_detective/detect_fields/FR/geo/region/__init__.py +0 -16
- csv_detective/detect_fields/FR/geo/region/region.txt +0 -44
- csv_detective/detect_fields/FR/other/__init__.py +0 -0
- csv_detective/detect_fields/FR/other/code_csp_insee/__init__.py +0 -26
- csv_detective/detect_fields/FR/other/code_csp_insee/code_csp_insee.txt +0 -498
- csv_detective/detect_fields/FR/other/code_rna/__init__.py +0 -8
- csv_detective/detect_fields/FR/other/code_waldec/__init__.py +0 -12
- csv_detective/detect_fields/FR/other/csp_insee/__init__.py +0 -16
- csv_detective/detect_fields/FR/other/date_fr/__init__.py +0 -12
- csv_detective/detect_fields/FR/other/insee_ape700/__init__.py +0 -16
- csv_detective/detect_fields/FR/other/sexe/__init__.py +0 -9
- csv_detective/detect_fields/FR/other/siren/__init__.py +0 -18
- csv_detective/detect_fields/FR/other/tel_fr/__init__.py +0 -15
- csv_detective/detect_fields/FR/other/uai/__init__.py +0 -15
- csv_detective/detect_fields/FR/temp/__init__.py +0 -0
- csv_detective/detect_fields/FR/temp/jour_de_la_semaine/__init__.py +0 -23
- csv_detective/detect_fields/FR/temp/mois_de_annee/__init__.py +0 -37
- csv_detective/detect_fields/__init__.py +0 -57
- csv_detective/detect_fields/geo/__init__.py +0 -0
- csv_detective/detect_fields/geo/iso_country_code_alpha2/__init__.py +0 -15
- csv_detective/detect_fields/geo/iso_country_code_alpha3/__init__.py +0 -14
- csv_detective/detect_fields/geo/iso_country_code_numeric/__init__.py +0 -15
- csv_detective/detect_fields/geo/json_geojson/__init__.py +0 -22
- csv_detective/detect_fields/geo/latitude_wgs/__init__.py +0 -13
- csv_detective/detect_fields/geo/latlon_wgs/__init__.py +0 -15
- csv_detective/detect_fields/geo/longitude_wgs/__init__.py +0 -13
- csv_detective/detect_fields/other/__init__.py +0 -0
- csv_detective/detect_fields/other/booleen/__init__.py +0 -21
- csv_detective/detect_fields/other/email/__init__.py +0 -8
- csv_detective/detect_fields/other/float/__init__.py +0 -17
- csv_detective/detect_fields/other/int/__init__.py +0 -12
- csv_detective/detect_fields/other/json/__init__.py +0 -24
- csv_detective/detect_fields/other/mongo_object_id/__init__.py +0 -8
- csv_detective/detect_fields/other/twitter/__init__.py +0 -8
- csv_detective/detect_fields/other/url/__init__.py +0 -11
- csv_detective/detect_fields/other/uuid/__init__.py +0 -11
- csv_detective/detect_fields/temp/__init__.py +0 -0
- csv_detective/detect_fields/temp/date/__init__.py +0 -62
- csv_detective/detect_fields/temp/datetime_iso/__init__.py +0 -18
- csv_detective/detect_fields/temp/datetime_rfc822/__init__.py +0 -21
- csv_detective/detect_fields/temp/year/__init__.py +0 -10
- csv_detective/detect_labels/FR/__init__.py +0 -0
- csv_detective/detect_labels/FR/geo/__init__.py +0 -0
- csv_detective/detect_labels/FR/geo/adresse/__init__.py +0 -40
- csv_detective/detect_labels/FR/geo/code_commune_insee/__init__.py +0 -42
- csv_detective/detect_labels/FR/geo/code_departement/__init__.py +0 -33
- csv_detective/detect_labels/FR/geo/code_fantoir/__init__.py +0 -33
- csv_detective/detect_labels/FR/geo/code_postal/__init__.py +0 -41
- csv_detective/detect_labels/FR/geo/code_region/__init__.py +0 -33
- csv_detective/detect_labels/FR/geo/commune/__init__.py +0 -33
- csv_detective/detect_labels/FR/geo/departement/__init__.py +0 -47
- csv_detective/detect_labels/FR/geo/insee_canton/__init__.py +0 -33
- csv_detective/detect_labels/FR/geo/latitude_l93/__init__.py +0 -54
- csv_detective/detect_labels/FR/geo/latitude_wgs_fr_metropole/__init__.py +0 -55
- csv_detective/detect_labels/FR/geo/longitude_l93/__init__.py +0 -44
- csv_detective/detect_labels/FR/geo/longitude_wgs_fr_metropole/__init__.py +0 -45
- csv_detective/detect_labels/FR/geo/pays/__init__.py +0 -45
- csv_detective/detect_labels/FR/geo/region/__init__.py +0 -45
- csv_detective/detect_labels/FR/other/__init__.py +0 -0
- csv_detective/detect_labels/FR/other/code_csp_insee/__init__.py +0 -33
- csv_detective/detect_labels/FR/other/code_rna/__init__.py +0 -38
- csv_detective/detect_labels/FR/other/code_waldec/__init__.py +0 -33
- csv_detective/detect_labels/FR/other/csp_insee/__init__.py +0 -37
- csv_detective/detect_labels/FR/other/date_fr/__init__.py +0 -33
- csv_detective/detect_labels/FR/other/insee_ape700/__init__.py +0 -40
- csv_detective/detect_labels/FR/other/sexe/__init__.py +0 -33
- csv_detective/detect_labels/FR/other/siren/__init__.py +0 -41
- csv_detective/detect_labels/FR/other/siret/__init__.py +0 -40
- csv_detective/detect_labels/FR/other/tel_fr/__init__.py +0 -45
- csv_detective/detect_labels/FR/other/uai/__init__.py +0 -50
- csv_detective/detect_labels/FR/temp/__init__.py +0 -0
- csv_detective/detect_labels/FR/temp/jour_de_la_semaine/__init__.py +0 -41
- csv_detective/detect_labels/FR/temp/mois_de_annee/__init__.py +0 -33
- csv_detective/detect_labels/__init__.py +0 -43
- csv_detective/detect_labels/geo/__init__.py +0 -0
- csv_detective/detect_labels/geo/iso_country_code_alpha2/__init__.py +0 -41
- csv_detective/detect_labels/geo/iso_country_code_alpha3/__init__.py +0 -41
- csv_detective/detect_labels/geo/iso_country_code_numeric/__init__.py +0 -41
- csv_detective/detect_labels/geo/json_geojson/__init__.py +0 -42
- csv_detective/detect_labels/geo/latitude_wgs/__init__.py +0 -55
- csv_detective/detect_labels/geo/latlon_wgs/__init__.py +0 -67
- csv_detective/detect_labels/geo/longitude_wgs/__init__.py +0 -45
- csv_detective/detect_labels/other/__init__.py +0 -0
- csv_detective/detect_labels/other/booleen/__init__.py +0 -34
- csv_detective/detect_labels/other/email/__init__.py +0 -45
- csv_detective/detect_labels/other/float/__init__.py +0 -33
- csv_detective/detect_labels/other/int/__init__.py +0 -33
- csv_detective/detect_labels/other/money/__init__.py +0 -11
- csv_detective/detect_labels/other/money/check_col_name.py +0 -8
- csv_detective/detect_labels/other/mongo_object_id/__init__.py +0 -33
- csv_detective/detect_labels/other/twitter/__init__.py +0 -33
- csv_detective/detect_labels/other/url/__init__.py +0 -48
- csv_detective/detect_labels/other/uuid/__init__.py +0 -33
- csv_detective/detect_labels/temp/__init__.py +0 -0
- csv_detective/detect_labels/temp/date/__init__.py +0 -51
- csv_detective/detect_labels/temp/datetime_iso/__init__.py +0 -45
- csv_detective/detect_labels/temp/datetime_rfc822/__init__.py +0 -44
- csv_detective/detect_labels/temp/year/__init__.py +0 -44
- csv_detective/detection.py +0 -361
- csv_detective/process_text.py +0 -39
- csv_detective/s3_utils.py +0 -48
- csv_detective-0.6.7.data/data/share/csv_detective/CHANGELOG.md +0 -118
- csv_detective-0.6.7.data/data/share/csv_detective/LICENSE.AGPL.txt +0 -661
- csv_detective-0.6.7.data/data/share/csv_detective/README.md +0 -247
- csv_detective-0.6.7.dist-info/LICENSE.AGPL.txt +0 -661
- csv_detective-0.6.7.dist-info/METADATA +0 -23
- csv_detective-0.6.7.dist-info/RECORD +0 -150
- csv_detective-0.6.7.dist-info/WHEEL +0 -5
- csv_detective-0.6.7.dist-info/top_level.txt +0 -2
- tests/__init__.py +0 -0
- tests/test_fields.py +0 -360
- tests/test_file.py +0 -116
- tests/test_labels.py +0 -7
- /csv_detective/{detect_fields/FR/other/csp_insee → formats/data}/csp_insee.txt +0 -0
- /csv_detective/{detect_fields/geo/iso_country_code_alpha2 → formats/data}/iso_country_code_alpha2.txt +0 -0
- /csv_detective/{detect_fields/geo/iso_country_code_alpha3 → formats/data}/iso_country_code_alpha3.txt +0 -0
- /csv_detective/{detect_fields/geo/iso_country_code_numeric → formats/data}/iso_country_code_numeric.txt +0 -0
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
# CSV Detective
|
|
2
|
-
|
|
3
|
-
This is a package to **automatically detect column content in CSV files**. As of now, the script reads the first few rows of the CSV and performs various checks to see for each column if it matches with various content types. This is currently done through regex and string comparison.
|
|
4
|
-
|
|
5
|
-
## How To ?
|
|
6
|
-
|
|
7
|
-
### Install the package
|
|
8
|
-
|
|
9
|
-
You need to have python >= 3.7 installed. We recommend using a virtual environement.
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
pip install csv-detective
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Detect some columns
|
|
16
|
-
|
|
17
|
-
Say you have a CSV file located in `file_path`. This is how you could use `csv_detective`:
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
# Import the csv_detective package
|
|
21
|
-
from csv_detective.explore_csv import routine
|
|
22
|
-
import os # for this example only
|
|
23
|
-
import json # for json dump only
|
|
24
|
-
|
|
25
|
-
# Replace by your file path
|
|
26
|
-
file_path = os.path.join('.', 'tests', 'code_postaux_v201410.csv')
|
|
27
|
-
|
|
28
|
-
# Open your file and run csv_detective
|
|
29
|
-
inspection_results = routine(
|
|
30
|
-
file_path,
|
|
31
|
-
num_rows=-1, # Value -1 will analyze all lines of your csv, you can change with the number of lines you wish to analyze
|
|
32
|
-
output_mode="LIMITED", # By default value is LIMITED, if you want result of analysis of all detections made, you can apply an output_mode="ALL"
|
|
33
|
-
save_results=False, # Default False. If True, it will save result output into the same directory than the csv analyzed
|
|
34
|
-
output_profile=True, # Default False. If True, returned dict will contain a property "profile" indicating profile (min, max, mean, tops...) of every column of you csv
|
|
35
|
-
output_schema=True, # Default False. If True, returned dict will contain a property "schema" containing basic [tableschema](https://specs.frictionlessdata.io/table-schema/) of your file. This can be use to validate structure of other csv which should match same structure.
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# Write your file as json
|
|
40
|
-
with open(file_path.replace('.csv', '.json'), 'w', encoding='utf8') as fp:
|
|
41
|
-
json.dump(inspection_results, fp, indent=4, separators=(',', ': '))
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## So What Do You Get ?
|
|
46
|
-
|
|
47
|
-
### Output
|
|
48
|
-
|
|
49
|
-
The program creates a `Python` dictionnary with the following information :
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
{
|
|
53
|
-
"heading_columns": 0, # Number of heading columns
|
|
54
|
-
"encoding": "windows-1252", # Encoding detected
|
|
55
|
-
"ints_as_floats": [], # Columns where integers may be represented as floats
|
|
56
|
-
"trailing_columns": 0, # Number of trailing columns
|
|
57
|
-
"headers": ['code commune INSEE', 'nom de la commune', 'code postal', "libell\\u00e9 d'acheminement\n"], # Header row
|
|
58
|
-
"separator": ";", # Detected CSV separator
|
|
59
|
-
"headers_row": 0, # Number of heading rows
|
|
60
|
-
"columns": { # Property that conciliate detection from labels and content of a column
|
|
61
|
-
"Code commune": {
|
|
62
|
-
"python_type": "string",
|
|
63
|
-
"format": "code_commune_insee",
|
|
64
|
-
"score": 1.0
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
"columns_labels": { # Property that return detection from header columns
|
|
68
|
-
"Code commune": {
|
|
69
|
-
"python_type": "string",
|
|
70
|
-
"format": "code_commune_insee",
|
|
71
|
-
"score": 0.5
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
"columns_fields": { # Property that return detection from content columns
|
|
75
|
-
"Code commune": {
|
|
76
|
-
"python_type": "string",
|
|
77
|
-
"format": "code_commune_insee",
|
|
78
|
-
"score": 1.25
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
"profile": {
|
|
82
|
-
"column_name" : {
|
|
83
|
-
"min": 1, # only int and float
|
|
84
|
-
"max: 12, # only int and float
|
|
85
|
-
"mean": 5, # only int and float
|
|
86
|
-
"std": 5, # only int and float
|
|
87
|
-
"tops": [ # limited to 10
|
|
88
|
-
"xxx",
|
|
89
|
-
"yyy",
|
|
90
|
-
"..."
|
|
91
|
-
],
|
|
92
|
-
"nb_distinct": 67,
|
|
93
|
-
"nb_missing_values": 102
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"schema": {
|
|
97
|
-
"$schema": "https://frictionlessdata.io/schemas/table-schema.json",
|
|
98
|
-
"name": "",
|
|
99
|
-
"title": "",
|
|
100
|
-
"description": "",
|
|
101
|
-
"countryCode": "FR",
|
|
102
|
-
"homepage": "",
|
|
103
|
-
"path": "https://github.com/etalab/csv-detective",
|
|
104
|
-
"resources": [],
|
|
105
|
-
"sources": [
|
|
106
|
-
{"title": "Spécification Tableschema", "path": "https://specs.frictionlessdata.io/table-schema"},
|
|
107
|
-
{"title": "schema.data.gouv.fr", "path": "https://schema.data.gouv.fr"}
|
|
108
|
-
],
|
|
109
|
-
"created": "2023-02-10",
|
|
110
|
-
"lastModified": "2023-02-10",
|
|
111
|
-
"version": "0.0.1",
|
|
112
|
-
"contributors": [
|
|
113
|
-
{"title": "Table schema bot", "email": "schema@data.gouv.fr", "organisation": "data.gouv.fr", "role": "author"}
|
|
114
|
-
],
|
|
115
|
-
"fields": [
|
|
116
|
-
{
|
|
117
|
-
"name": "Code commune",
|
|
118
|
-
"description": "Le code INSEE de la commune",
|
|
119
|
-
"example": "23150",
|
|
120
|
-
"type": "string",
|
|
121
|
-
"formatFR": "code_commune_insee",
|
|
122
|
-
"constraints": {
|
|
123
|
-
"required": False,
|
|
124
|
-
"pattern": "^([013-9]\\d|2[AB1-9])\\d{3}$",
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### What Formats Can Be Detected
|
|
133
|
-
|
|
134
|
-
Includes :
|
|
135
|
-
|
|
136
|
-
- Communes, Départements, Régions, Pays
|
|
137
|
-
- Codes Communes, Codes Postaux, Codes Departement, ISO Pays
|
|
138
|
-
- Codes CSP, Description CSP, SIREN
|
|
139
|
-
- E-Mails, URLs, Téléphones FR
|
|
140
|
-
- Years, Dates, Jours de la Semaine FR
|
|
141
|
-
- UUIDs, Mongo ObjectIds
|
|
142
|
-
|
|
143
|
-
### Format detection and scoring
|
|
144
|
-
For each column, 3 scores are computed for each format, the higher the score, the more likely the format:
|
|
145
|
-
- the field score based on the values contained in the column (0.0 to 1.0).
|
|
146
|
-
- the label score based on the header of the column (0.0 to 1.0).
|
|
147
|
-
- the overall score, computed as `field_score * (1 + label_score/2)` (0.0 to 1.5).
|
|
148
|
-
|
|
149
|
-
The overall score computation aims to give more weight to the column contents while
|
|
150
|
-
still leveraging the column header.
|
|
151
|
-
|
|
152
|
-
#### `output_mode` - Select the output mode you want for json report
|
|
153
|
-
|
|
154
|
-
This option allows you to select the output mode you want to pass. To do so, you have to pass a `output_mode` argument to the `routine` function. This variable has two possible values:
|
|
155
|
-
|
|
156
|
-
- `output_mode` defaults to `'LIMITED'` which means report will contain only detected column formats based on a pre-selected threshold proportion in data. Report result is the standard output (an example can be found above in 'Output' section).
|
|
157
|
-
Only the format with highest score is present in the output.
|
|
158
|
-
- `output_mode='ALL'` which means report will contain a full list of all column format possibilities for each input data columns with a value associated which match to the proportion of found column type in data. With this report, user can adjust its rules of detection based on a specific threshold and has a better vision of quality detection for each columns. Results could also be easily transformed into dataframe (columns types in column / column names in rows) for analysis and test.
|
|
159
|
-
|
|
160
|
-
## TODO (this list is too long)
|
|
161
|
-
|
|
162
|
-
- Clean up
|
|
163
|
-
- Make more robust
|
|
164
|
-
- Batch analyse
|
|
165
|
-
- Command line interface
|
|
166
|
-
- Improve output format
|
|
167
|
-
- Improve testing structure to make modular searches (search only for cities for example)
|
|
168
|
-
- Get rid of `pandas` dependency
|
|
169
|
-
- Improve pre-processing and pre-processing tracing (removing heading rows for example)
|
|
170
|
-
- Make differentiated pre-processing (no lower case for country codes for example)
|
|
171
|
-
- Give a sense of probability in the prediction
|
|
172
|
-
- Add more and more detection modules...
|
|
173
|
-
|
|
174
|
-
Related ideas:
|
|
175
|
-
|
|
176
|
-
- store column names to make a learning model based on column names for (possible pre-screen)
|
|
177
|
-
- normalising data based on column prediction
|
|
178
|
-
- entity resolution (good luck...)
|
|
179
|
-
|
|
180
|
-
## Why Could This Be of Any Use ?
|
|
181
|
-
|
|
182
|
-
Organisations such as [data.gouv](http://data.gouv.fr) aggregate huge amounts of un-normalised data. Performing cross-examination across datasets can be difficult. This tool could help enrich the datasets metadata and facilitate linking them together.
|
|
183
|
-
|
|
184
|
-
[Here](https://github.com/Leobouloc/data.gouv-exploration) is project (just started) that has code to download all csv files from the data.gouv website and analyse them using csv_detective.
|
|
185
|
-
|
|
186
|
-
## Release
|
|
187
|
-
|
|
188
|
-
The release process uses `bumpr`.
|
|
189
|
-
|
|
190
|
-
```shell
|
|
191
|
-
pip install -r requirements-build.txt
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### Process
|
|
195
|
-
|
|
196
|
-
1. `bumpr` will handle bumping the version according to your command (patch, minor, major)
|
|
197
|
-
2. It will update the CHANGELOG according to the new version being published
|
|
198
|
-
3. It will push a tag with the given version to github
|
|
199
|
-
4. CircleCI will pickup this tag, build the package and publish it to pypi
|
|
200
|
-
5. `bumpr` will have everything ready for the next version (version, changelog...)
|
|
201
|
-
|
|
202
|
-
### Dry run
|
|
203
|
-
|
|
204
|
-
```shell
|
|
205
|
-
bumpr -d -v
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Release
|
|
209
|
-
|
|
210
|
-
This will release a patch version:
|
|
211
|
-
|
|
212
|
-
```shell
|
|
213
|
-
bumpr -v
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
See bumpr options for minor and major:
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
$ bumpr -h
|
|
220
|
-
usage: bumpr [-h] [--version] [-v] [-c CONFIG] [-d] [-st] [-b | -pr] [-M] [-m] [-p]
|
|
221
|
-
[-s SUFFIX] [-u] [-pM] [-pm] [-pp] [-ps PREPARE_SUFFIX] [-pu]
|
|
222
|
-
[--vcs {git,hg}] [-nc] [-P] [-nP]
|
|
223
|
-
[file] [files ...]
|
|
224
|
-
|
|
225
|
-
[...]
|
|
226
|
-
|
|
227
|
-
optional arguments:
|
|
228
|
-
-h, --help show this help message and exit
|
|
229
|
-
--version show program's version number and exit
|
|
230
|
-
-v, --verbose Verbose output
|
|
231
|
-
-c CONFIG, --config CONFIG
|
|
232
|
-
Specify a configuration file
|
|
233
|
-
-d, --dryrun Do not write anything and display a diff
|
|
234
|
-
-st, --skip-tests Skip tests
|
|
235
|
-
-b, --bump Only perform the bump
|
|
236
|
-
-pr, --prepare Only perform the prepare
|
|
237
|
-
|
|
238
|
-
bump:
|
|
239
|
-
-M, --major Bump major version
|
|
240
|
-
-m, --minor Bump minor version
|
|
241
|
-
-p, --patch Bump patch version
|
|
242
|
-
-s SUFFIX, --suffix SUFFIX
|
|
243
|
-
Set suffix
|
|
244
|
-
-u, --unsuffix Unset suffix
|
|
245
|
-
|
|
246
|
-
[...]
|
|
247
|
-
```
|