Skip to main content

Smart Citizen Data

DOI Binder PyPI version Python application

Welcome to SmartCitizen Data. This is a data analysis framework for working with sensor data in different ways:

  • Interacting with several sensors APIs
  • Clean data, export and calculate metrics
  • Model sensor data and calibrate sensors
  • Generate data visualisations - matplotlib, plotly or uplot
  • Generate analysis reports in html or pdf and upload them to Zenodo

Installation

You can check it out in the Binder before installing if you want. Works with Python 3.* (tested between 3.9 and 3.11).

You can just run:

pip install scdata

Plots (device.ts_plot(), maps, panels...) need the plotting libraries, an optional extra. Without them scdata loads and processes data, and plotting raises an error that says how to install them:

pip install "scdata[plot]"

Parquet needs the storage extra: the backups (local or S3: device.load_from_storage(), device.backup_to_storage()) and exports in parquet (device.export(..., file_format='parquet')):

pip install "scdata[storage]"

Examples (scripts and notebooks) are in examples.

Work on the source code

Simply clone the repository with:

git clone https://github.com/fablabbcn/smartcitizen-data.git
cd smartcitizen-data

Install scdata package with requirements:

python setup.py install

Or if you want to edit:

pip install --editable ".[dev]"

Tokens and config

Blueprints, calibrations and sensor names are read from BASE_POSTPROCESSING_URL, the same variable as smartcitizen-connector. By default it is this repository on GitHub; set it to https://flows.smartcitizen.me/api/v1/ to use the metadata served by Smart Citizen Flows.

Settings can be changed in ~/.config/scdata/config.yaml. The file only keeps what differs from the defaults (the defaults of new versions apply after upgrading), for instance:

data:
  reload_metadata: false
paths:
  export: /home/me/exports

The data folder is ~/.cache/scdata by default ($XDG_CACHE_HOME/scdata if it is set), with the raw, processed, export... folders inside. Each folder of paths is changed on its own, and only to a folder that exists: changing data does not move the others. To move them all, set XDG_CACHE_HOME.

Also, .env files will be picked from ~/.cache/scdata. An env.example is provided. If you want to upload data to Zenodo, you will need to fill set an environment variable called ZENODO_TOKEN in your environment. The .env file is not mandatory for scdata to work. It only serves for authentication if you want to POST or GET data without throttling. You can still do GET requests but they will be throttled if not authenticated/authorized by the platform. See user roles for more info.

Using with jupyter lab (optional)

It can also be used with jupyter lab or jupyter. For this install juypterlab.

Contribute

Issues and PR more than welcome!

Funding

This work has received funding from the European Union's Horizon 2020 research and innovation program under the grant agreement No. 689954

Metadata

Release files for scdata 1.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scdata 1.6.4
File Size Uploaded
scdata-1.6.4.tar.gz 339.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scdata 1.6.4
File Interpreter ABI Platform
scdata-1.6.4-py3-none-any.whl Python 3 none any Details

Total release size: 705.6 kB

Release files / scdata-1.6.4.tar.gz

Download URL scdata-1.6.4.tar.gz
Size 339.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4f56a36035d0996b85bc8044560a14b7d84dc6438d6f809349deb358537e3bbc
BLAKE2b-256 checksum
How to use checksums
a6b27a082b1d57bd0142fec238ecfe08eeb2c362616d772acfdf9af21477cda3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / scdata-1.6.4-py3-none-any.whl

Download URL scdata-1.6.4-py3-none-any.whl
Size 366.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d00323fabe812575f62ae88dd9eabcebd4243b9789a3a724c0879db6805d3d29
BLAKE2b-256 checksum
How to use checksums
08d93f4f1c9f7a9ba87a32003f1f27442674e05944a42bd11111d379563a9f79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.6.4 This release

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.0

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page