Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shoorick/tram-age
Compute age of public transportation in Russian cities
https://github.com/shoorick/tram-age
grabbing-content python3 statistics
Last synced: 3 days ago
JSON representation
Compute age of public transportation in Russian cities
- Host: GitHub
- URL: https://github.com/shoorick/tram-age
- Owner: shoorick
- License: mit
- Created: 2020-11-05T20:46:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-10T22:15:49.000Z (about 4 years ago)
- Last Synced: 2024-11-10T19:25:19.229Z (2 months ago)
- Topics: grabbing-content, python3, statistics
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compute age of trams in Russian cities
The most of systems of public transportation in Russia uses ancient wagons.
List of passenger vehicles by particular city is available at URL like https://transphoto.org/list.php?serv=0&cid=54&t=1, list of Russian cities available at https://transphoto.org/country/1/This program fetches data for specified city and type of transportation and then make some statistical computation.
## Preparing
```bash
make prepare
. env/bin/activate
```or
```bash
sudo apt install pip3-venv
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt
```## Usage
```bash
compute.py [-h] [-c CITY] [-t TYPE] [-l LANGUAGE]
```### Optional arguments
* `-h`, `--help` — show help message and exit
* `-c` _CITY_, `--city` _CITY_ — number or name
(default city is Moscow)
* `-t` _TYPE_, `--type` _TYPE_ — transportation type
(digit `1` to `9` or name, default value is tram)
* `-l` _CODE_, `--language` _CODE_ —
[ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1)
language code (default is `ru` for Russian)
* `-o` _FILE_, `--output` _FILE_ — output frequency table to file.
Format detected by filename without case sensitivity.#### File formats
* CSV — Comma Separated Values — `file.csv`
* HTML — Hypertext Markup Language — `file.htm`, `file.html`
* JSON — JavaScript Notation Object — `file.json`, `file.js`
* Microsoft Excel — `file.xls` (legacy), `file.xlsx`## Examples
It's possible to use digital IDs
```
$ python compute.py --city 229 --type 2
Миасс, троллейбус
-----------------
1987 1 #
1988 3 ###
1989 1 #
1992 2 ##
1993 2 ##
2002 2 ##
2004 1 #
2005 1 #
2006 1 #
2007 1 #
2008 3 ###
2009 6 ######
2011 1 #
2020 2 ##
------------
Total 28
Mean: 2002.6, median: 2006.5, modes: [2009]
```or human readable names
```
$ python compute.py --city Ekb --type metro --language en
Yekaterinburg, metro
--------------------
1988 6 ######
1989 39 #######################################
2011 8 ########
2019 8 ########
------------
Total 61
Mean: 1995.7, median: 1989.0, modes: [1989]
```Names can be specified in English or in Russian.
There are aliases for cities and types for example:
* metro = metropolitain = subway = underground
* tramway = tram = tm
* SPb = Saint Petersburg = Petersburg## See also
* https://transphoto.org/country/1/
* https://www.facebook.com/chelurban/posts/927689021093721
* http://shoorick.ru/2017/11/10/old-trams/## Author
Alexander Sapozhnikov
http://shoorick.ru/