Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 46 additions & 0 deletions .github/workflows/monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Validate mobile library datasets

on:
push:
paths:
- 'data/**'
- 'schemas/**'
- 'scripts/**'
- 'services.csv'
- 'datapackage.json'
- 'requirements.txt'
- '.github/workflows/**'
pull_request:
branches:
- main
schedule:
# Runs at 00:00 on day 1 of every 6th month (January and July)
- cron: '0 0 1 */6 *'
workflow_dispatch:

jobs:
validate-and-monitor:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Validate datapackage and datasets
run: |
python scripts/validate.py

- name: Build and verify unified UK dataset
run: |
python scripts/combine.py
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.pyc
*.pyo
*.pyo
__pycache__/
.pytest_cache/
69 changes: 47 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,68 @@
# Mobile libaries data
# Mobile libraries data

This repository is for transforming data for the [mobile libraries project](https://blog.librarydata.uk/mobile-library-data-project).
[![Validate mobile library datasets](https://github.com/librarieshacked/mobilelibraries-data/actions/workflows/monitor.yml/badge.svg)](https://github.com/librarieshacked/mobilelibraries-data/actions/workflows/monitor.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Prerequisites
This project collects and publishes open data about UK mobile library services. It brings together timetables, stop locations, and driving routes across England, Scotland, Wales, and Northern Ireland into clean, consistent files.

Scripts are written in Python v3.
It is part of the [Libraries Hacked](https://www.librarieshacked.org) project. For background and analysis, see the [Mobile Library Data Project](https://blog.librarydata.uk/mobile-library-data-project).

- [Python](https://www.python.org/)
## Getting started

```console
pip install geopandas
pip install beautifulsoup4
pip install requests
```
### What you need

## Running scripts
* Python 3.10 or later installed on your computer.

Each individual script can be run from the command line. For example:
### How to install

```python
python north_somerset.py
```bash
git clone https://github.com/librarieshacked/mobilelibraries-data.git
cd mobilelibraries-data
pip install -r requirements.txt
```

Run the following when in the data directory for each authority.
### Quick commands

```console
ogr2ogr -f "CSV" aberdeenshire_routes.csv aberdeenshire_routes.geojson -lco GEOMETRY=AS_WKT
```
* **Check the data:** `python scripts/validate.py`
* **Combine all UK stops:** `python scripts/combine.py`
* **Work out driving routes:** `python scripts/routing.py --all`
* **Update a single council:** `python scripts/<council_name>.py`

For more details, see [how to run the scripts](docs/usage.md).

## Documentation

More information is available in these guides:

* **[Data schema and visit frequency](docs/schema.md)** - What each column in the files means and how visit cycles are written.
* **[Location and map coordinates](docs/geocoding.md)** - How stop locations are found, checked, and kept accurate.
* **[Driving routes between stops](docs/routing.md)** - How road routes and travel times are worked out.
* **[List of all UK library services](docs/services-registry.md)** - The master list of all 216 UK library authorities and their mobile status.
* **[How to run the scripts](docs/usage.md)** - How to update council data, combine stops, and run the route tools.
* **[Data checking and quality](docs/validation.md)** - How we test that files are complete and correctly formatted.
* **[How to contribute](docs/contributing.md)** - How to help by adding a council or updating a timetable.

## Built with

* [Python 3](https://www.python.org/) - Code for collecting and cleaning data
* [Frictionless Data](https://framework.frictionlessdata.io/) - Data standards and automated checking
* [Postcodes.io](https://postcodes.io/) - Free UK postcode location service
* [OpenStreetMap](https://www.openstreetmap.org/) and [OSRM](http://project-osrm.org/) - Map data and road routing
* [OpenRouteService](https://openrouteservice.org/) - Lorry-friendly road routing

## Authors

- **Dave Rowe** - _Initial work_ - [DaveBathnes](https://github.com/DaveBathnes)
* **Libraries Hacked** - [Libraries Hacked](https://www.librarieshacked.org)

See also the list of [contributors](https://github.com/librarieshacked/mobilelibraries-database/contributors) who participated in this project.
See the list of [contributors](https://github.com/librarieshacked/mobilelibraries-data/contributors) who have helped with this project.

## License

All code in this project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
* **Code:** Licensed under the [MIT License](LICENSE.md).
* **Data:** Sourced and adapted from council publications under the [Open Government Licence v3.0](http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/) where applicable.

## Acknowledgments

- All mobile library services and their data
* Council library services and dedicated mobile library drivers and staff
* [OpenStreetMap](https://www.openstreetmap.org/) contributors
* [Ordnance Survey](https://www.ordnancesurvey.co.uk/) OpenData
Loading
Loading