This is a hobby project that explores data analysis and visualization using Python and Streamlit. The project focuses on analyzing mock data from a fictional sharable bicycle service called OV-Pedal. Please note that the data in this project does not represent actual data. It is designed purely for educational and experimentation purposes.
This repo includes a Dev Container. Dev Containers allow you to define a customized, container-based development environment inside Visual Studio Code. To set up the Dev Container, execute the following steps.
- Install and configure Docker for your operating system. Make sure Docker is running.
- Install VS Code.
- Install the Dev Containers extension in Visual Studio Code.
- Clone this repository and open in VS Code.
- You'll get a pop-up saying "Folder contains Dev Container configuration file. Reopen folder to develop in container". Click "Reopen in Container". If the pop-up doesn't show, you can open the Command Palette and select "Dev Containers: Open Folder in Container...".
- You can now develop and run code in the Dev Container! Note that the repo does not contain any data yet, you can generate the data with the instructions in the next section.
The scripts/generate_datasets.py
script generates two dummy datasets simulating the availability of shared bicycles and rental events for a period of 3 months. These datasets are used for analysis and visualization in the Streamlit app.
To generate the datasets, follow these steps:
- If you are not using the Dev Container: install the required libraries listed in
requirements.txt
usingpip install -r requirements.txt
. - Run the
generate_datasets.py
script: `python ./src/generate_mock_data.py. - The datasets will be saved in the
data/
directory.
This repo contains a Streamlit app to visualize the generated data. It provides interactive visualizations and insights into bike availability and rental durations across different locations.
To run the Streamlit app locally, follow these steps:
- If you are not using the Dev Container: install the required libraries listed in
requirements.txt
usingpip install -r requirements.txt
. - Run the app by executing
streamlit run ./app.py
in your terminal. - Copy the URL from the terminal and open it in a web browser, allowing you to explore the data visualizations.
To run the Streamlit app in a Docker container, follow these steps:
- Make sure your repository contains the generated data, see the section "Data Generation".
- Install and configure Docker for your operating system. Make sure Docker is running.
- Open a terminal or command prompt in the directory of the repo and run the following command:
docker build -t pedal-palooza .
- After the image is built, run a container from the image with the following command:
docker run -p 8501:8501 pedal-palooza
- You can now view your Streamlit app in your browser: http://0.0.0.0:8501
You can deploy the Streamlit app on Azure using Docker by building the Docker image, pushing it to Azure Container Registry (ACR), and creating an Azure Web App for Containers to run the image. This setup allows you to host and access your Streamlit app on Azure's scalable cloud infrastructure.
This project uses mock data and does not represent actual data. It is designed purely for educational and experimentation purposes.
Part of the code, including data generation and Streamlit app setup, was generated using ChatGPT. In addition to playing around with Streamlit, I wanted to experiment with promt writing and iterative code development with the help of a tool like ChatGPT.
Feel free to explore, modify, and expand upon the code to learn and experiment further.
For any questions or suggestions, please feel free to reach out.