- Authentication: Users can log in using JWT (JSON Web Tokens) for secure authentication.
- Inject Sensor data: Authenticate user can inject data in batch.
- Filter and Update: Sensor data can be fetched by filtering parameters.
- Analysys: Get informative insignts from sensor data using analysis api.
To get started, clone the repository to your local machine:
git clone https://github.com/Faizgeeky/CoulombAI-Task.git
cd CoulombAI-Task
-
Install the required dependencies:
pip install -r requirements.txt
-
Setup Env varibales:
export FLASK_APP=app.py export FLASK_DEBUG=1
-
Config env variable [Currently it is defined in confg.py that can be use din env var]
export SECRET_KEY = 'jkbkjbvc-bkjbjkb-jka-kjbjkbkbda' export JWT_SECRET_KEY = 'kjbjkaebk-kjbjba-kjbajb'
- Run flask server:
flask run
/auth/register
/auth/login
/v1/data/ // POST & GET Sensor data injection and filtering
/v1/data/<sensor_id> // Retrive Sensor data by sensor_id
/v1/data/<id> // PUT update sensor data
/v1/data/aggregate // GET - all you want to know about sensor data
- Run API testing :
pytest -s
pytest
pytest {filename}
A CoulombAI.postman_collection.json
file is included for easy testing of the API endpoints with Postman. Simply import this file into Postman to get started.
|-app.py (entry point and regiterd all blueprints)
|-config.py (configurations and env variables - can be stored in env for better security)
|-requirements.txt
|-extension.py (to keep all 3rd party modeuls at one place)
|-instance
|-app.db (database)
|-api
|-model.py (User and Sensor database model defined)
|-route
|- auth.py (auth routes)
|- sensor.py (sensor routes)
|- views.py (bussiness logic)
|-schema (used marsmallow seriaizers)
|- user.py
|-sensor.py
- It has all the api's endpoint with request and response
- You can import it in postman and use it to test the api's
```sh
/v1/data/?sensor_id=1&start_date=2022-01
// You can pass many filters here as per task like start_date, end_date, aggregate =['hourly','daily'] , pressure, temperature
- Handling large data injest asynly while storing
- Data analysis - can get more details about sensor like , predictive analysis , correlation over time , increment or decrement by month , year , etc