The database contains the following tables:
- request_logs
Column Name | Type |
---|---|
id | int (autogenerated PK) |
timestamp | varchar (format: 'YYYY-MM-DD hh:mm:ss' |
emergency_type | varchar (police, medical) |
core_id | varchar (id of sending device) |
latitude | float |
longitude | float |
accuracy | float |
status | varchar ('a'(active), 'w'(working), 'r'(resolved) |
- rlogs/ (GET): Get all elements on request_logs in json format.
Example output:
[
{
"id": 32,
"timestamp": "2020-04-01 14:31:14",
"emergency_type": "police",
"core_id": "e00fce683d2b75dcdd4efd71",
"latitude": 30.333935,
"longitude": 78.023621,
"accuracy": 36.0,
"status": "a"
},
{
"id": 33,
"timestamp": "2020-04-01 15:31:14",
"emergency_type": "police",
"core_id": "e00fce683d2b75dcdd4efd71",
"latitude": 30.333935,
"longitude": 78.023621,
"accuracy": 36.0,
"status": "a"
},
]
- rlogs/ (POST): Post event to server to add in databse.
Example body:
{
"accuracy": "36.000000",
"longitude": "78.023621",
"latitude": "30.333935",
"emergency": "police-e00fce683d2b75dcdd4efd71",
"timestamp": "2020-04-01T14:31:14.640Z"
}
NOTE: How to run server as backgroud process?
python <path>/MeshSOS/django-server/backend/manage.py runserver >> <path>/django.logs &
ngrok http 8000 -config=ngrok.yml --log=stdout > ngrok.log &