flowmaps-data
A tool for downloading COVID-19 and mobility datasets for Spain.
The database integrates two main types of data:
-
Time dependent population mobility networks across Spain (provided by MITMA and INE)
-
Daily reports of COVID-19 cases in Spain, at different levels of spatial resolution (provided by the CNE and the different Autonomous Communities)
All the data records are associated with a specific area from a geographic layer:
- Geographic layers for Spain, in geojson format, at different levels of spatial resolution.
All the data has been gather from official access points.
More info about the data: https://flowmaps.life.bsc.es/flowboard/data
API: https://flowmaps.life.bsc.es/api
Contact us: https://flowmaps.life.bsc.es/flowboard/contact
Installation
Install using pip:
pip install flowmaps-data
Install manually:
Create virtual environment:
virtualenv env --python=python3
source env/bin/activate
Install python dependencies:
pip3 install -r requirements.txt
Usage
Command line utility
usage: flowmaps-data [-h] COLLECTION [list describe download]
examples:
# Geojson layers
flowmaps-data layers list
flowmaps-data layers describe --layer cnig_provincias --provenance
flowmaps-data layers describe --layer cnig_provincias --plot
flowmaps-data layers download --layer cnig_provincias
# Consolidated COVID-19 data
flowmaps-data covid19 list
flowmaps-data covid19 describe --ev ES.covid_cpro
flowmaps-data covid19 download --ev ES.covid_cpro --output-file out.csv --output-type csv
# Deceased datasets
flowmaps-data deceased list
flowmaps-data deceased describe --ev ES.hosp_covid_cpro
flowmaps-data deceased download --ev ES.hosp_covid_cpro --output-file out.csv --output-type csv
# Population
flowmaps-data population list
flowmaps-data population describe --layer cnig_provincias
flowmaps-data population download --layer zbs_15 --output-file out.csv
# Origin-destination daily mobility (from MITMA)
flowmaps-data daily_mobility_matrix list
flowmaps-data daily_mobility_matrix describe
flowmaps-data daily_mobility_matrix download --source-layer cnig_provincias --target-layer cnig_provincias --start-date 2020-10-10 --end-date 2020-10-16 --output-file out.csv
# Daily zone movements (from MITMA)
flowmaps-data zone_movements list
flowmaps-data zone_movements describe
flowmaps-data zone_movements download --layer cnig_provincias --output-file out.csv --start-date 2020-10-10 --end-date 2020-10-10
# Other datasets
flowmaps-data datasets list
flowmaps-data datasets describe --ev ES.covid_cpro
flowmaps-data datasets download --ev ES.covid_cpro --output-file out.csv --output-type csv
# Mobility Associated Risk
flowmaps-data risk list
flowmaps-data risk list-dates
flowmaps-data risk download --source-layer cnig_provincias --target-layer cnig_provincias --ev ES.covid_cpro --date 2020-10-10 --output-file out.csv --output-format csv
Python module
from flowmaps_data import geolayer, covid19, dataset, daily_mobility_matrix, population, zone_movements
# Geojson layers
geojson = geolayer('cnig_provincias')
# Consolidated COVID-19 data
df = covid19(ev='ES.covid_cpro')
# Raw health datasets
df = dataset(ev='ES.covid_cpro')
# Origin-destination daily mobility (from MITMA)
df = daily_mobility_matrix(source_layer='cnig_provincias', target_layer='cnig_provincias', start_date='2020-11-01', end_date='2020-12-01', source='28', target='08')
# Daily zone movements (from MITMA)
df = zone_movements(layer='cnig_provincias')
# Population
df = population('cnig_provincias')
More examples
Plot daily incidence by province
from flowmaps_data import geolayer, covid19
import plotly.graph_objects as go
# Download geojson layer
geojson = geolayer('cnig_provincias')
# Download COVID-19 data
df = covid19(ev='ES.covid_cpro')
# Select data for one date
date = '2020-10-10'
df = df[df['date'] == date]
# Plot
fig = go.Figure(go.Choroplethmapbox(geojson=geojson,
locations=date_df['id'],
z=date_df['new_cases'],
colorscale="Reds",
marker_opacity=0.8))
fig.update_layout(title=f'Covid-19 daily incidence at {date}',
mapbox_style="carto-positron",
mapbox_zoom=4.5,
mapbox_center={"lat": 40.495178477814555, "lon": -3.717336960173357})
fig.update_layout(margin={"r":0,"t":30,"l":0,"b":0})
fig.show()
Metadata
Release files for flowmaps-data 0.0.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flowmaps_data-0.0.25.tar.gz | 18.3 kB | Without provenance | Details for flowmaps_data-0.0.25.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flowmaps_data-0.0.25-py3-none-any.whl | Python 3 | none | any | Details for flowmaps_data-0.0.25-py3-none-any.whl |
Total release size: 37.1 kB
Release files / flowmaps_data-0.0.25.tar.gz
| Download URL | flowmaps_data-0.0.25.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a8d5d5239e2bd7bea93d7b326b91097f528130d31ef3b1bc6bb528099d48490
|
|
BLAKE2b-256 checksum How to use checksums |
4609585ea3cfcc756ae661735aac57d9b04844c042ccfc32154342a7f66d6e93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15
|
Release files / flowmaps_data-0.0.25-py3-none-any.whl
| Download URL | flowmaps_data-0.0.25-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0650954610005324d578fb507e7df35da463e671e984279e2855ce944c4a7585
|
|
BLAKE2b-256 checksum How to use checksums |
0707087c3b523db1bb08b34f6215c58428cad79b5e621aa2ffdf5c74b837f47b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15
|
Security for flowmaps-data 0.0.25
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.