This project is a FastAPI-based backend system designed to process, store, and serve visitor-related data for specified zones. It supports analyzing visitor behavior based on data such as:
- Visitor Types
- Age Groups
- Dwell Times
The application utilizes SQLite as its database and provides RESTful API endpoints for querying aggregated information.
database.py
: Manages the database connection and session lifecycle using SQLAlchemy.models.py
: Defines the database schema using SQLAlchemy ORM models.
poc.py
: Handles the creation of database tables and imports visitor data from CSV files.
crud.py
: Implements the database query logic for aggregating and filtering visitor data.
main.py
: Exposes RESTful API endpoints for querying visitor data, including visitor types, age groups, and dwell times.
requirements.txt
: Lists the Python dependencies required for the application.Dockerfile
anddocker-compose.yml
: Define the containerized setup for running the application.
- Docker installed on your system.
- A terminal or command-line interface.
-
Clone the Repository Clone the project repository to your local machine:
git clone <repository-url> cd <repository-directory>
-
Build and Run the Application Navigate to the project directory containing the
Dockerfile
anddocker-compose.yml
. Then, run the following command:docker-compose up --build
-
Access the API Once the application starts, the API will be accessible at:
http://127.0.0.1:8000
-
Test the Endpoints Use a tool like Postman, cURL, or a browser to test the available API endpoints:
- GET /visitor-types/
- GET /ages/
- GET /dwell-times/
- Import visitor data from CSV files into a structured SQLite database.
- Serve visitor analytics through intuitive RESTful endpoints.
- Filter results by date, zone, and specific attributes like age group or dwell time.
- Easy-to-setup Docker-based deployment.
Enjoy using the project!