Estimate and optimize service coverage of public infrastructure facilities.
Project description
Public Infrastructure Service Access (PISA)
PISA assists policymakers in identifying and planning key resources such as roads, bridges, and healthcare centres. It helps to optimise the placement of new infrastructure investments. Its goal is to increase access to public services, reduce expenses, and improve the quality of life in a region.
Documentation
For detailed documentation on the code, read the docs.
⚠️ Important:
The latest version of PISA contains significant refactoring and improvements.
If you need the original codebase, use version0.1.0available from the GitHub releases or refer to the list of releases for more information.
For new projects and ongoing development, it is recommended to use the latest version to benefit from updated features and optimizations.
User Installation
To install the latest version of PISA, you can use pip:
pip install pisa_abw
It is recommended to use a virtual environment to avoid dependency conflicts.
Local Development
Installation
The source code of this project can be installed in two ways to make it accessible for development and testing:
Option 1: Using Poetry (Recommended)
This project uses Poetry for dependency and packaging management.
- Install Poetry by following the official installation instructions
- Clone the repository:
git clone https://github.com/yourusername/Public-Infrastructure-Service-Access.git - Navigate to the repository folder:
cd Public-Infrastructure-Service-Access - Install the project and its dependencies:
poetry install
Option 2: Using pip and venv
If you prefer traditional Python package management:
- Clone the repository:
git clone https://github.com/yourusername/Public-Infrastructure-Service-Access.git - Navigate to the repository folder:
cd Public-Infrastructure-Service-Access - Create a virtual environment:
python -m venv venv - Activate the virtual environment:
- Windows:
venv\Scripts\activate - macOS/Linux:
source venv/bin/activate
- Windows:
- Install the package:
pip install dist/pisa_abw-2.0.0-py3-none-any.whl
If you need the original codebase, use the wheel file for version
0.1.0(pip install dist/gpbp-0.1.0-py3-none-any.whl)
External Dependencies
PISA requires additional tools for certain functionality:
-
Optimization Solver: Used to optimize the location of new facilities.
- For beginners, we recommend the COIN-OR Branch-and-Cut solver (CBC)
- Note the path to the executable of
cbcfor configuration - Advanced users can substitute CBC with other solvers compatible with the package
-
Mapbox API (Optional): Used to generate facility isopolygons.
- Sign up for a free Mapbox account
- Get your API key from the Mapbox account dashboard
After installing cbc and/or creating a Mapbox API key, create a .env file in the repository root with the following settings:
# Path to your cbc solver executable (for optimization)
CBC_SOLVER_PATH=<path_to_solver>
# Mapbox API key (optional, for isopolygon generation)
MAPBOX_API_TOKEN=<your_api_key_here>
This file is ignored by git by default for security.
Usage
We provide two examples to understand and interact with the package:
- Some example usage can be seen in the
examples/pisa_showcase_*.ipynbnotebooks. These notebooks show the basic package data flow and allow you to explore the outputs of each function. The notebooks differ in the tool used to generate isopolygons: OSM or Mapbox. Note that Mapbox requires an API key (see External Dependencies section above). - A more visual example can be seen in the Streamlit app to interact with the package using a graphical interface. You can start the app by running
streamlit run pisa_abw_app/main_page.pyfrom the main repository directory, which will automatically open a browser window.
Deploying/running the web interface (Docker)
Docker is a tool that allows you to package an application and its dependencies in a virtual container that can run on most operating systems. The web interface for the PISA project can be run using Docker. To do this, you need to have Docker installed on your system. You can download Docker from here.
After you have installed Docker, you can run the following command in the repository to build an image of the PISA project. The Dockerfile uses Poetry to install the application and its dependencies inside the image, consistent with the recommended installation method, and includes all necessary geospatial libraries.
docker build -t pisa_abw .
Now that you have built the image, you can run a container using it. The following command will run a container from the pisa_abw image and expose the web interface on port 8501 to localhost only. The command will show the URL on which it's accessible. The container will be named pisa_abw as well.
docker run -p 127.0.0.1:8501:8501 --name pisa_abw pisa_abw
You can use the following commands to manage the container after the initial run:
# Stop the container
docker stop pisa_abw
# Start a stopped container
docker start pisa_abw
# View logs from the container
docker logs pisa_abw
# Remove the container (if you need to start fresh)
docker rm pisa_abw
The image is also ready to be deployed on a server or a cloud platform that supports Docker.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pisa_abw-2.0.0.tar.gz.
File metadata
- Download URL: pisa_abw-2.0.0.tar.gz
- Upload date:
- Size: 31.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.8 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a02114d4b69a6a1b0108176a9e3053ee751e84f7bd17f8db76e36ae73203c41b
|
|
| MD5 |
b63ba7578fa04939b80cfc09a959bea8
|
|
| BLAKE2b-256 |
7ba6e1cf300110a1a05f596268da1065d032ce684580417a56f169e7121ac717
|
File details
Details for the file pisa_abw-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pisa_abw-2.0.0-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.8 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3051086401f044f07305e813b347a42617157a85b06be1ad4b288d771f6f0ee
|
|
| MD5 |
a77d86458048e034a90b7cd5ef1b7f67
|
|
| BLAKE2b-256 |
a09ee15029165cbd4f6964692b4b732a1f441fe4e7a1d502475b3ba0caf017d3
|