mobisurvstd 0.1.0__tar.gz
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.
- mobisurvstd-0.1.0/LICENSE.md +7 -0
- mobisurvstd-0.1.0/PKG-INFO +210 -0
- mobisurvstd-0.1.0/README.md +179 -0
- mobisurvstd-0.1.0/pyproject.toml +41 -0
- mobisurvstd-0.1.0/setup.cfg +4 -0
- mobisurvstd-0.1.0/src/mobisurvstd/__init__.py +8 -0
- mobisurvstd-0.1.0/src/mobisurvstd/__main__.py +4 -0
- mobisurvstd-0.1.0/src/mobisurvstd/classes.py +344 -0
- mobisurvstd-0.1.0/src/mobisurvstd/clean.py +1661 -0
- mobisurvstd-0.1.0/src/mobisurvstd/cli.py +44 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/__init__.py +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/cars.py +120 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/clean.py +470 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/households.py +97 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/legs.py +136 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/modes.py +52 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/motorcycles.py +44 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/persons.py +228 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/trips.py +253 -0
- mobisurvstd-0.1.0/src/mobisurvstd/common/zones.py +43 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/__init__.py +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/deplacements.py +170 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/menages.py +378 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/personnes.py +307 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/survey.py +84 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/trajets.py +211 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2010/zones.py +11 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/__init__.py +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/deplacements.py +173 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/menages.py +162 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/motos.py +103 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/personnes.py +391 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/survey.py +89 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/trajets.py +317 -0
- mobisurvstd-0.1.0/src/mobisurvstd/egt2020/voitures.py +128 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/__init__.py +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/common.py +42 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/deplacements.py +153 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/menages.py +358 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/personnes.py +305 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/survey.py +309 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/trajets.py +274 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emc2/zones.py +107 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/__init__.py +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/deplacements.py +407 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/menages.py +182 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/motos.py +126 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/personnes.py +543 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/survey.py +93 -0
- mobisurvstd-0.1.0/src/mobisurvstd/emp/voitures.py +218 -0
- mobisurvstd-0.1.0/src/mobisurvstd/logger.py +15 -0
- mobisurvstd-0.1.0/src/mobisurvstd/main.py +158 -0
- mobisurvstd-0.1.0/src/mobisurvstd/resources/__init__.py +0 -0
- mobisurvstd-0.1.0/src/mobisurvstd/resources/admin_express.py +88 -0
- mobisurvstd-0.1.0/src/mobisurvstd/resources/insee_data.py +307 -0
- mobisurvstd-0.1.0/src/mobisurvstd/resources/nuts.py +129 -0
- mobisurvstd-0.1.0/src/mobisurvstd/schema.py +902 -0
- mobisurvstd-0.1.0/src/mobisurvstd/utils.py +125 -0
- mobisurvstd-0.1.0/src/mobisurvstd.egg-info/PKG-INFO +210 -0
- mobisurvstd-0.1.0/src/mobisurvstd.egg-info/SOURCES.txt +61 -0
- mobisurvstd-0.1.0/src/mobisurvstd.egg-info/dependency_links.txt +1 -0
- mobisurvstd-0.1.0/src/mobisurvstd.egg-info/requires.txt +12 -0
- mobisurvstd-0.1.0/src/mobisurvstd.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright © 2025 Lucas Javaudin
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mobisurvstd
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A tool to standardize French mobility survey datasets (EMC2, EGT, EMP, etc.) into a unified format.
|
|
5
|
+
Author-email: Lucas Javaudin <lucas@lucasjavaudin.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MobiSurvStd/MobiSurvStd
|
|
8
|
+
Project-URL: Documentation, https://mobisurvstd.github.io/MobiSurvStd/index.html
|
|
9
|
+
Project-URL: Repository, https://github.com/MobiSurvStd/MobiSurvStd
|
|
10
|
+
Project-URL: Issues, https://github.com/MobiSurvStd/MobiSurvStd/issues
|
|
11
|
+
Keywords: mobility survey,polars,data format
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: File Formats
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE.md
|
|
18
|
+
Requires-Dist: Cartopy>=0.24.1
|
|
19
|
+
Requires-Dist: fastexcel>=0.14.0
|
|
20
|
+
Requires-Dist: geopandas>=1.0.1
|
|
21
|
+
Requires-Dist: loguru>=0.7.3
|
|
22
|
+
Requires-Dist: matplotlib>=3.10.1
|
|
23
|
+
Requires-Dist: numpy>=2.2.4
|
|
24
|
+
Requires-Dist: pandas>=2.2.3
|
|
25
|
+
Requires-Dist: polars>=1.31.0
|
|
26
|
+
Requires-Dist: py7zr>=0.22.0
|
|
27
|
+
Requires-Dist: pyarrow>=19.0.1
|
|
28
|
+
Requires-Dist: requests>=2.32.3
|
|
29
|
+
Requires-Dist: typer>=0.16.0
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# MobiSurvStd
|
|
33
|
+
|
|
34
|
+
*A tool to standardize French mobility survey datasets (EMC², EGT, EMP, etc.) into a unified format.*
|
|
35
|
+
|
|
36
|
+
📚 [Documentation](https://mobisurvstd.github.io/MobiSurvStd)
|
|
37
|
+
📦 [View on PyPI](https://pypi.org/project/mobisurvstd/)
|
|
38
|
+
|
|
39
|
+
<span style="color:blue">🇫🇷 [Version française](./README.fr.md)</span>
|
|
40
|
+
|
|
41
|
+
## Table of Contents
|
|
42
|
+
- [Introduction](#introduction)
|
|
43
|
+
- [Mobility Surveys in France](#mobility-surveys-in-france)
|
|
44
|
+
- [Why MobiSurvStd?](#why-mobisurvstd)
|
|
45
|
+
- [Installation](#installation)
|
|
46
|
+
- [Getting Started](#getting-started)
|
|
47
|
+
- [Supported Surveys](#supported-surveys)
|
|
48
|
+
- [Legal Notice](#legal-notice)
|
|
49
|
+
- [Contributing](#contributing)
|
|
50
|
+
|
|
51
|
+
## Introduction
|
|
52
|
+
|
|
53
|
+
MobiSurvStd (Mobility Survey Standardizer) is an easy-to-use Python command line interface to convert many French mobility surveys
|
|
54
|
+
(EMC², EGT, EMP, etc.) to a unique standardized and clean format.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Mobility Surveys in France
|
|
59
|
+
|
|
60
|
+
In France, despite recent efforts by CEREMA to create a standard format for mobility surveys – with
|
|
61
|
+
the EMC² surveys – various formats co-exist:
|
|
62
|
+
|
|
63
|
+
- [**EMC²**](https://www.cerema.fr/fr/activites/mobilites/connaissance-modelisation-evaluation-mobilite/enquetes-mobilite-emc2)
|
|
64
|
+
(Enquête mobilité certifiée CEREMA): mobility surveys for many French territories (since 2018);
|
|
65
|
+
- [**EGT H2020**](https://omnil.fr/actualites/les-resultats-de-la-derniere-enquete-globale-transport)
|
|
66
|
+
(Enquête Globale Transport, Île-de-France Mobilités): mobility survey for Île-de-France (2018–2020;
|
|
67
|
+
incomplete due to COVID-19);
|
|
68
|
+
- [**EMP**](https://www.statistiques.developpement-durable.gouv.fr/resultats-detailles-de-lenquete-mobilite-des-personnes-de-2019)
|
|
69
|
+
(Enquête mobilité des personnes, SDES): national mobility survey (2019).
|
|
70
|
+
- [**EMG**](https://www.institutparisregion.fr/mobilite-et-transports/deplacements/enquete-regionale-sur-la-mobilite-des-franciliens/)
|
|
71
|
+
(Enquête Mobilité par GPS, Institut Paris Région): mobility survey for Île-de-France (2022-2023)
|
|
72
|
+
with individuals tracked over several days through GPS.
|
|
73
|
+
|
|
74
|
+
Also surveys based on previous formats are still in use today:
|
|
75
|
+
|
|
76
|
+
- **EDVM** (Enquêtes Déplacements Villes Moyennes, CEREMA): mobility surveys for medium-size cities
|
|
77
|
+
(until 2018);
|
|
78
|
+
- **EDGT** (Enquêtes Déplacements Grands Territoires, CEREMA): mobility surveys for periphery areas
|
|
79
|
+
(until 2018);
|
|
80
|
+
- [**EGT 2010**](https://omnil.fr/egt-2010) (Enquête Globale Transport, Île-de-France Mobilités):
|
|
81
|
+
previous version of the Île-de-France mobility survey;
|
|
82
|
+
- [**ENTD**](https://www.statistiques.developpement-durable.gouv.fr/enquete-nationale-transports-et-deplacements-entd-2008)
|
|
83
|
+
(Enquête nationale transports et déplacements, SDES): former national mobility survey (2008).
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Why MobiSurvStd?
|
|
88
|
+
|
|
89
|
+
The existing formats all have the same drawbacks:
|
|
90
|
+
|
|
91
|
+
- Data are sorted in CSV files which are not always straightforward to read (Which separator?
|
|
92
|
+
Which encoding? What are the variable datatypes?).
|
|
93
|
+
- Variable names and modalities are not always clear (e.g., in the EMC² format, variable "P2"
|
|
94
|
+
represents the gender of the person, with modality 1 for a man and 2 for a woman).
|
|
95
|
+
- Joining two datasets is hard and not well documented (e.g., in the EMC² format, to join the
|
|
96
|
+
persons with their household, the variables to use are "METH", "ZFM" and "ECH" for the households
|
|
97
|
+
and "DMET", "ZFD" and "ECH" for the persons).
|
|
98
|
+
|
|
99
|
+
Additionally, when working with different territories / periods, it is often necessary to write a
|
|
100
|
+
similar code multiple times due to the existence of different formats.
|
|
101
|
+
|
|
102
|
+
MobiSurvStd solves all these issues by being able to convert all survey formats to a [well-defined
|
|
103
|
+
Parquet format](https://mobisurvstd.github.io/MobiSurvStd/format/index.html).
|
|
104
|
+
|
|
105
|
+
See [this example](https://mobisurvstd.github.io/MobiSurvStd/problem-example.html) to understand how
|
|
106
|
+
MobiSurvStd can simplify your workflow.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Installation
|
|
111
|
+
|
|
112
|
+
Install the library with
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install mobisurvstd
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Getting Started
|
|
121
|
+
|
|
122
|
+
Download the
|
|
123
|
+
[EMP 2019 survey](https://www.statistiques.developpement-durable.gouv.fr/resultats-detailles-de-lenquete-mobilite-des-personnes-de-2019)
|
|
124
|
+
_(Données individuelles anonymisées (fichiers au format CSV))_, then run the following command:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
python -m mobisurvstd emp_2019_donnees_individuelles_anonymisees_novembre2024.zip standardized_emp2019 --survey-type emp2019
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
It will standardize the EMP 2019 survey and save the resulting Parquet files in the
|
|
131
|
+
`standardized_emp2019` directory.
|
|
132
|
+
These Parquet files can then be analyzed using e.g., [polars](https://pola.rs/) or
|
|
133
|
+
[pandas](https://pandas.pydata.org) in Python or [arrow](https://arrow.apache.org/docs/r/) in R.
|
|
134
|
+
|
|
135
|
+
A detailed definition of the Parquet format used by MobiSurvStd is available
|
|
136
|
+
[here](https://mobisurvstd.github.io/MobiSurvStd/format/index.html).
|
|
137
|
+
|
|
138
|
+
You can also standardize surveys programmatically in Python with the `standardize` function:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
import mobisurvstd
|
|
142
|
+
mobisurvstd.standardize(
|
|
143
|
+
"emp_2019_donnees_individuelles_anonymisees_novembre2024.zip",
|
|
144
|
+
"standardized_emp2019",
|
|
145
|
+
survey_type="emp2019",
|
|
146
|
+
)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For more, check the [User Guide](https://mobisurvstd.github.io/MobiSurvStd/howto.html).
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Case Study: Bicycle Use
|
|
154
|
+
|
|
155
|
+
The following graph represents the share of bicycle trips for all EMC² surveys and the EGT 2020
|
|
156
|
+
survey.
|
|
157
|
+
The circle colors represent the average number of bicycles in the surveyed households.
|
|
158
|
+
The circle sizes represent the expected number of trips in the surveyed area.
|
|
159
|
+
|
|
160
|
+
The graph has been generated from the code in
|
|
161
|
+
[analyses/bicycle_shares.py](analyses/bicycle_shares.py).
|
|
162
|
+
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+
The following map represents the share of bicycle trips within INSEE municipalities.
|
|
166
|
+
Only municipalities with more than 30 surveyed trips are shown.
|
|
167
|
+
|
|
168
|
+
The map has been generated from the code in
|
|
169
|
+
[analyses/bicycle_shares_by_insee.py](analyses/bicycle_shares_by_insee.py).
|
|
170
|
+
|
|
171
|
+

|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Supported Surveys
|
|
176
|
+
|
|
177
|
+
Currently, MobiSurvStd supports the following survey types:
|
|
178
|
+
|
|
179
|
+
- `emp2019`
|
|
180
|
+
- `emc2`
|
|
181
|
+
- `egt2020`
|
|
182
|
+
- `egt2010`
|
|
183
|
+
|
|
184
|
+
See [Survey Types](https://mobisurvstd.github.io/MobiSurvStd/surveys.html) for more.
|
|
185
|
+
|
|
186
|
+
Other survey types that are planned to be integrated are: `edvm`, `edgt`, `entd`, `emg`.
|
|
187
|
+
If you know another survey format that could be integrated, feel free to open an issue on GitHub.
|
|
188
|
+
|
|
189
|
+
MobiSurvStd covers only French mobility survey formats.
|
|
190
|
+
If other countries have similar survey formats, they might be easily integrated into MobiSurvStd (or
|
|
191
|
+
a variant of it).
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Legal Notice
|
|
196
|
+
|
|
197
|
+
<span style="color:red">
|
|
198
|
+
⚠️ <strong>MobiSurvStd does not anonymize the data.</strong>
|
|
199
|
+
If you are working with confidential datasets (e.g., EMC² or EGT surveys), you must apply the same
|
|
200
|
+
confidentiality rules to the standardized data as to the original data.
|
|
201
|
+
In particular, <strong>you must not share the standardized data</strong> if your confidentiality
|
|
202
|
+
agreement prohibits sharing the original data.
|
|
203
|
+
</span>
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Contributing
|
|
208
|
+
|
|
209
|
+
If you think you found a bug, if you have a suggestion, or if you want to integrate a new format,
|
|
210
|
+
feel free to open an issue on GitHub or to create a Pull Request.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# MobiSurvStd
|
|
2
|
+
|
|
3
|
+
*A tool to standardize French mobility survey datasets (EMC², EGT, EMP, etc.) into a unified format.*
|
|
4
|
+
|
|
5
|
+
📚 [Documentation](https://mobisurvstd.github.io/MobiSurvStd)
|
|
6
|
+
📦 [View on PyPI](https://pypi.org/project/mobisurvstd/)
|
|
7
|
+
|
|
8
|
+
<span style="color:blue">🇫🇷 [Version française](./README.fr.md)</span>
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
- [Introduction](#introduction)
|
|
12
|
+
- [Mobility Surveys in France](#mobility-surveys-in-france)
|
|
13
|
+
- [Why MobiSurvStd?](#why-mobisurvstd)
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Getting Started](#getting-started)
|
|
16
|
+
- [Supported Surveys](#supported-surveys)
|
|
17
|
+
- [Legal Notice](#legal-notice)
|
|
18
|
+
- [Contributing](#contributing)
|
|
19
|
+
|
|
20
|
+
## Introduction
|
|
21
|
+
|
|
22
|
+
MobiSurvStd (Mobility Survey Standardizer) is an easy-to-use Python command line interface to convert many French mobility surveys
|
|
23
|
+
(EMC², EGT, EMP, etc.) to a unique standardized and clean format.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Mobility Surveys in France
|
|
28
|
+
|
|
29
|
+
In France, despite recent efforts by CEREMA to create a standard format for mobility surveys – with
|
|
30
|
+
the EMC² surveys – various formats co-exist:
|
|
31
|
+
|
|
32
|
+
- [**EMC²**](https://www.cerema.fr/fr/activites/mobilites/connaissance-modelisation-evaluation-mobilite/enquetes-mobilite-emc2)
|
|
33
|
+
(Enquête mobilité certifiée CEREMA): mobility surveys for many French territories (since 2018);
|
|
34
|
+
- [**EGT H2020**](https://omnil.fr/actualites/les-resultats-de-la-derniere-enquete-globale-transport)
|
|
35
|
+
(Enquête Globale Transport, Île-de-France Mobilités): mobility survey for Île-de-France (2018–2020;
|
|
36
|
+
incomplete due to COVID-19);
|
|
37
|
+
- [**EMP**](https://www.statistiques.developpement-durable.gouv.fr/resultats-detailles-de-lenquete-mobilite-des-personnes-de-2019)
|
|
38
|
+
(Enquête mobilité des personnes, SDES): national mobility survey (2019).
|
|
39
|
+
- [**EMG**](https://www.institutparisregion.fr/mobilite-et-transports/deplacements/enquete-regionale-sur-la-mobilite-des-franciliens/)
|
|
40
|
+
(Enquête Mobilité par GPS, Institut Paris Région): mobility survey for Île-de-France (2022-2023)
|
|
41
|
+
with individuals tracked over several days through GPS.
|
|
42
|
+
|
|
43
|
+
Also surveys based on previous formats are still in use today:
|
|
44
|
+
|
|
45
|
+
- **EDVM** (Enquêtes Déplacements Villes Moyennes, CEREMA): mobility surveys for medium-size cities
|
|
46
|
+
(until 2018);
|
|
47
|
+
- **EDGT** (Enquêtes Déplacements Grands Territoires, CEREMA): mobility surveys for periphery areas
|
|
48
|
+
(until 2018);
|
|
49
|
+
- [**EGT 2010**](https://omnil.fr/egt-2010) (Enquête Globale Transport, Île-de-France Mobilités):
|
|
50
|
+
previous version of the Île-de-France mobility survey;
|
|
51
|
+
- [**ENTD**](https://www.statistiques.developpement-durable.gouv.fr/enquete-nationale-transports-et-deplacements-entd-2008)
|
|
52
|
+
(Enquête nationale transports et déplacements, SDES): former national mobility survey (2008).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Why MobiSurvStd?
|
|
57
|
+
|
|
58
|
+
The existing formats all have the same drawbacks:
|
|
59
|
+
|
|
60
|
+
- Data are sorted in CSV files which are not always straightforward to read (Which separator?
|
|
61
|
+
Which encoding? What are the variable datatypes?).
|
|
62
|
+
- Variable names and modalities are not always clear (e.g., in the EMC² format, variable "P2"
|
|
63
|
+
represents the gender of the person, with modality 1 for a man and 2 for a woman).
|
|
64
|
+
- Joining two datasets is hard and not well documented (e.g., in the EMC² format, to join the
|
|
65
|
+
persons with their household, the variables to use are "METH", "ZFM" and "ECH" for the households
|
|
66
|
+
and "DMET", "ZFD" and "ECH" for the persons).
|
|
67
|
+
|
|
68
|
+
Additionally, when working with different territories / periods, it is often necessary to write a
|
|
69
|
+
similar code multiple times due to the existence of different formats.
|
|
70
|
+
|
|
71
|
+
MobiSurvStd solves all these issues by being able to convert all survey formats to a [well-defined
|
|
72
|
+
Parquet format](https://mobisurvstd.github.io/MobiSurvStd/format/index.html).
|
|
73
|
+
|
|
74
|
+
See [this example](https://mobisurvstd.github.io/MobiSurvStd/problem-example.html) to understand how
|
|
75
|
+
MobiSurvStd can simplify your workflow.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
Install the library with
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install mobisurvstd
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Getting Started
|
|
90
|
+
|
|
91
|
+
Download the
|
|
92
|
+
[EMP 2019 survey](https://www.statistiques.developpement-durable.gouv.fr/resultats-detailles-de-lenquete-mobilite-des-personnes-de-2019)
|
|
93
|
+
_(Données individuelles anonymisées (fichiers au format CSV))_, then run the following command:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -m mobisurvstd emp_2019_donnees_individuelles_anonymisees_novembre2024.zip standardized_emp2019 --survey-type emp2019
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
It will standardize the EMP 2019 survey and save the resulting Parquet files in the
|
|
100
|
+
`standardized_emp2019` directory.
|
|
101
|
+
These Parquet files can then be analyzed using e.g., [polars](https://pola.rs/) or
|
|
102
|
+
[pandas](https://pandas.pydata.org) in Python or [arrow](https://arrow.apache.org/docs/r/) in R.
|
|
103
|
+
|
|
104
|
+
A detailed definition of the Parquet format used by MobiSurvStd is available
|
|
105
|
+
[here](https://mobisurvstd.github.io/MobiSurvStd/format/index.html).
|
|
106
|
+
|
|
107
|
+
You can also standardize surveys programmatically in Python with the `standardize` function:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import mobisurvstd
|
|
111
|
+
mobisurvstd.standardize(
|
|
112
|
+
"emp_2019_donnees_individuelles_anonymisees_novembre2024.zip",
|
|
113
|
+
"standardized_emp2019",
|
|
114
|
+
survey_type="emp2019",
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For more, check the [User Guide](https://mobisurvstd.github.io/MobiSurvStd/howto.html).
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Case Study: Bicycle Use
|
|
123
|
+
|
|
124
|
+
The following graph represents the share of bicycle trips for all EMC² surveys and the EGT 2020
|
|
125
|
+
survey.
|
|
126
|
+
The circle colors represent the average number of bicycles in the surveyed households.
|
|
127
|
+
The circle sizes represent the expected number of trips in the surveyed area.
|
|
128
|
+
|
|
129
|
+
The graph has been generated from the code in
|
|
130
|
+
[analyses/bicycle_shares.py](analyses/bicycle_shares.py).
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+
The following map represents the share of bicycle trips within INSEE municipalities.
|
|
135
|
+
Only municipalities with more than 30 surveyed trips are shown.
|
|
136
|
+
|
|
137
|
+
The map has been generated from the code in
|
|
138
|
+
[analyses/bicycle_shares_by_insee.py](analyses/bicycle_shares_by_insee.py).
|
|
139
|
+
|
|
140
|
+

|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Supported Surveys
|
|
145
|
+
|
|
146
|
+
Currently, MobiSurvStd supports the following survey types:
|
|
147
|
+
|
|
148
|
+
- `emp2019`
|
|
149
|
+
- `emc2`
|
|
150
|
+
- `egt2020`
|
|
151
|
+
- `egt2010`
|
|
152
|
+
|
|
153
|
+
See [Survey Types](https://mobisurvstd.github.io/MobiSurvStd/surveys.html) for more.
|
|
154
|
+
|
|
155
|
+
Other survey types that are planned to be integrated are: `edvm`, `edgt`, `entd`, `emg`.
|
|
156
|
+
If you know another survey format that could be integrated, feel free to open an issue on GitHub.
|
|
157
|
+
|
|
158
|
+
MobiSurvStd covers only French mobility survey formats.
|
|
159
|
+
If other countries have similar survey formats, they might be easily integrated into MobiSurvStd (or
|
|
160
|
+
a variant of it).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Legal Notice
|
|
165
|
+
|
|
166
|
+
<span style="color:red">
|
|
167
|
+
⚠️ <strong>MobiSurvStd does not anonymize the data.</strong>
|
|
168
|
+
If you are working with confidential datasets (e.g., EMC² or EGT surveys), you must apply the same
|
|
169
|
+
confidentiality rules to the standardized data as to the original data.
|
|
170
|
+
In particular, <strong>you must not share the standardized data</strong> if your confidentiality
|
|
171
|
+
agreement prohibits sharing the original data.
|
|
172
|
+
</span>
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
If you think you found a bug, if you have a suggestion, or if you want to integrate a new format,
|
|
179
|
+
feel free to open an issue on GitHub or to create a Pull Request.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# pyproject.toml
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "mobisurvstd"
|
|
9
|
+
version = "0.1.0"
|
|
10
|
+
description = "A tool to standardize French mobility survey datasets (EMC2, EGT, EMP, etc.) into a unified format."
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
authors = [{ name = "Lucas Javaudin", email = "lucas@lucasjavaudin.com" }]
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE.md"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: File Formats"
|
|
19
|
+
]
|
|
20
|
+
keywords = ["mobility survey", "polars", "data format"]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"Cartopy >= 0.24.1",
|
|
23
|
+
"fastexcel >= 0.14.0",
|
|
24
|
+
"geopandas >= 1.0.1",
|
|
25
|
+
"loguru >= 0.7.3",
|
|
26
|
+
"matplotlib >= 3.10.1",
|
|
27
|
+
"numpy >= 2.2.4",
|
|
28
|
+
"pandas >= 2.2.3",
|
|
29
|
+
"polars >= 1.31.0",
|
|
30
|
+
"py7zr >= 0.22.0",
|
|
31
|
+
"pyarrow >= 19.0.1",
|
|
32
|
+
"requests >= 2.32.3",
|
|
33
|
+
"typer >= 0.16.0",
|
|
34
|
+
]
|
|
35
|
+
requires-python = ">=3.10"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/MobiSurvStd/MobiSurvStd"
|
|
39
|
+
Documentation = "https://mobisurvstd.github.io/MobiSurvStd/index.html"
|
|
40
|
+
Repository = "https://github.com/MobiSurvStd/MobiSurvStd"
|
|
41
|
+
Issues = "https://github.com/MobiSurvStd/MobiSurvStd/issues"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from .classes import SurveyDataReader as SurveyDataReader
|
|
2
|
+
from .classes import read_many as read_many
|
|
3
|
+
from .logger import setup as setup
|
|
4
|
+
from .main import bulk_standardize as bulk_standardize
|
|
5
|
+
from .main import standardize as standardize
|
|
6
|
+
|
|
7
|
+
# Initialize logging.
|
|
8
|
+
setup()
|