ikoghoemmanuell
commited on
Commit
•
08e403b
1
Parent(s):
d6bdedb
Update app/main.py
Browse files- app/main.py +47 -46
app/main.py
CHANGED
@@ -65,52 +65,52 @@ class Patients(BaseModel):
|
|
65 |
@app.get("/")
|
66 |
def root():
|
67 |
message = """
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
"""
|
115 |
return {
|
116 |
"message": message.strip()
|
@@ -118,6 +118,7 @@ def root():
|
|
118 |
|
119 |
|
120 |
|
|
|
121 |
# Prediction endpoint
|
122 |
@app.post("/predict")
|
123 |
def predict_sepsis(patient: Patient):
|
|
|
65 |
@app.get("/")
|
66 |
def root():
|
67 |
message = """
|
68 |
+
Welcome to the Sepsis Prediction API!
|
69 |
+
|
70 |
+
This API provides endpoints for predicting sepsis based on patient data.
|
71 |
+
|
72 |
+
Endpoints:
|
73 |
+
|
74 |
+
[GET] /
|
75 |
+
Description: Root endpoint providing information about the API.
|
76 |
+
|
77 |
+
[POST] /predict
|
78 |
+
Description: Endpoint to make a single patient sepsis prediction.
|
79 |
+
Input: JSON payload containing patient data.
|
80 |
+
Example Payload:
|
81 |
+
{
|
82 |
+
"Blood_Work_R1": 123,
|
83 |
+
"Blood_Pressure": 80,
|
84 |
+
"Blood_Work_R3": 100,
|
85 |
+
"BMI": 25.5,
|
86 |
+
"Blood_Work_R4": 4.7,
|
87 |
+
"Patient_age": 50
|
88 |
+
}
|
89 |
+
|
90 |
+
[POST] /predict_multiple
|
91 |
+
Description: Endpoint to make sepsis predictions for multiple patients.
|
92 |
+
Input: JSON payload containing an array of patient objects.
|
93 |
+
Example Payload:
|
94 |
+
{
|
95 |
+
"all_patients": [
|
96 |
+
{
|
97 |
+
"Blood_Work_R1": 123,
|
98 |
+
"Blood_Pressure": 80,
|
99 |
+
"Blood_Work_R3": 100,
|
100 |
+
"BMI": 25.5,
|
101 |
+
"Blood_Work_R4": 4.7,
|
102 |
+
"Patient_age": 50
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"Blood_Work_R1": 140,
|
106 |
+
"Blood_Pressure": 90,
|
107 |
+
"Blood_Work_R3": 95,
|
108 |
+
"BMI": 27.2,
|
109 |
+
"Blood_Work_R4": 5.2,
|
110 |
+
"Patient_age": 45
|
111 |
+
}
|
112 |
+
]
|
113 |
+
}
|
114 |
"""
|
115 |
return {
|
116 |
"message": message.strip()
|
|
|
118 |
|
119 |
|
120 |
|
121 |
+
|
122 |
# Prediction endpoint
|
123 |
@app.post("/predict")
|
124 |
def predict_sepsis(patient: Patient):
|