- database.db --> a database that has populated data in it.
- main.py --> the code for the structure and the API endpoints
- populate_database.py --> this code when run puts FAKE data into the database
- requirements.txt --> holds packages along with their versions to be installed
This FastAPI-based project provides a RESTful API for managing entities, users, access groups, readers, sensors, measurements, and point types in an SQLite database using SQLModel. It includes CRUD operations for each entity and allows relationships between them.
- Entity, User, Access Group, Reader, Sensor, Measurement, and Point Type management
- SQLite database integration
- Automatic database creation and test data population
- FastAPI-based RESTful endpoints
- Relationship management using SQLModel
-
Clone the repository:
git clone <repository_url> cd <project_directory>
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts�ctivate`
-
Install dependencies:
pip install -r requirements.txt
Start the FastAPI server:
uvicorn main:app --reloadThis will start the API server at http://127.0.0.1:8000/.
You can use Swagger UI to interact with the API. The "testDataCreate" tool will populate the database.
Alternatively, test API calls using curl or tools like Postman.
The database is automatically created when the application starts. Test data can be populated using:
curl -X POST http://127.0.0.1:8000/testDataCreate- Create Entity:
POST /entity/ - Delete Entity:
DELETE /entity/{entity_id} - Update Entity:
PATCH /entity/{entity_id}
- Create User:
POST /user/ - Delete User:
DELETE /user/{user_id} - Update User:
PATCH /user/{user_id}
- Create Access Group:
POST /accessgroup/ - Delete Access Group:
DELETE /accessgroup/{accessgroup_id} - Update Access Group:
PATCH /accessgroup/{accessgroup_id}
- Create Reader:
POST /reader/ - Delete Reader:
DELETE /reader/{reader_id} - Update Reader:
PATCH /reader/{reader_id}
- Create Sensor:
POST /sensor/ - Delete Sensor:
DELETE /sensor/{sensor_id} - Update Sensor:
PATCH /sensor/{sensor_id}
- Create Measurement:
POST /measurement/ - Delete Measurement:
DELETE /measurement/{measurement_id} - Update Measurement:
PATCH /measurement/{measurement_id}
- Create Point Type:
POST /pointtype/ - Delete Point Type:
DELETE /pointtype/{pointtype_id} - Update Point Type:
PATCH /pointtype/{pointtype_id}
This project is not Licensed.