Skip to content

Commit

Permalink
New outputs based on updated data
Browse files Browse the repository at this point in the history
  • Loading branch information
hilfing committed Jul 28, 2024
1 parent 316047f commit 20e9a28
Show file tree
Hide file tree
Showing 2 changed files with 220 additions and 1 deletion.
2 changes: 1 addition & 1 deletion route_prediction_ai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main():

# Load and prepare the data
logging.info("Loading and preparing data")
data = load_data("final_data.csv")
data = load_data("route_prediction_ai/final_data.csv")
logging.info(f"Data loaded. Shape: {data.shape}")
grouped = data.groupby('upload_id')
logging.info(f"Data grouped by upload_id. Number of groups: {len(grouped)}")
Expand Down
219 changes: 219 additions & 0 deletions server_tests.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
### Register a new user
POST http://localhost:8000/auth/register
Content-Type: application/json

{
"username": "testuser",
"password": "testpassword"
}

### Get an access token
POST http://localhost:8000/auth/token
Content-Type: application/x-www-form-urlencoded

grant_type=&username=testuser&password=testpassword&scope=&client_id=&client_secret=

> {% client.global.set("access_token", response.body.access_token) %}

### Create 10 new traffic signals and store their IDs
POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 1",
"latitude": 12.9716,
"longitude": 77.5946,
"status": "GREEN"
}

> {% client.global.set("signal_id_1", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 2",
"latitude": 13.0827,
"longitude": 80.2707,
"status": "RED"
}

> {% client.global.set("signal_id_2", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 3",
"latitude": 28.7041,
"longitude": 77.1025,
"status": "YELLOW"
}

> {% client.global.set("signal_id_3", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 4",
"latitude": 19.0760,
"longitude": 72.8777,
"status": "GREEN"
}

> {% client.global.set("signal_id_4", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 5",
"latitude": 22.5726,
"longitude": 88.3639,
"status": "RED"
}

> {% client.global.set("signal_id_5", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 6",
"latitude": 23.0225,
"longitude": 72.5714,
"status": "YELLOW"
}

> {% client.global.set("signal_id_6", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 7",
"latitude": 18.5204,
"longitude": 73.8567,
"status": "GREEN"
}

> {% client.global.set("signal_id_7", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 8",
"latitude": 17.3850,
"longitude": 78.4867,
"status": "RED"
}

> {% client.global.set("signal_id_8", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 9",
"latitude": 11.0168,
"longitude": 76.9558,
"status": "YELLOW"
}

> {% client.global.set("signal_id_9", response.body.signal_id) %}

###

POST http://localhost:8000/signals/create
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"location": "Location 10",
"latitude": 26.9124,
"longitude": 75.7873,
"status": "GREEN"
}

> {% client.global.set("signal_id_10", response.body.signal_id) %}

### Update 5 signals with new status
PUT http://localhost:8000/signals/{{signal_id_1}}
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"status": "RED"
}

###

PUT http://localhost:8000/signals/{{signal_id_2}}
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"status": "GREEN"
}

###

PUT http://localhost:8000/signals/{{signal_id_3}}
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"status": "YELLOW"
}

###

PUT http://localhost:8000/signals/{{signal_id_4}}
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"status": "RED"
}

###

PUT http://localhost:8000/signals/{{signal_id_5}}
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
"status": "GREEN"
}

### Read all traffic signals
GET http://localhost:8000/signals/
Authorization: Bearer {{access_token}}

0 comments on commit 20e9a28

Please sign in to comment.