Commit 1d44d966 by arjun.b

db model added

parent b9569af7
......@@ -3,21 +3,12 @@ from scripts.core.handlers.assign_patient import assign_patient
class PublishHandler:
@staticmethod
def main_handler():
def main_handler(details):
doctors = ['Dr. Smith', 'Dr. Johnson', 'Dr. Brown', "Dr. Arjun B"]
i = 1
while i:
print("--------Consult a Doctor------\n")
choice = int(input("Enter your choice:"))
if choice == 1:
patient_id = input("Enter patient id: ")
description = input("Enter the description: ")
age = int(input("Enter the age: "))
name = input("Enter the name: ")
patient_details = {
"patient_id": patient_id,
"description": description,
"age": age,
"name": name
"patient_id": details.id,
"description": details.description,
"age": details.age,
"name": details.name
}
assign_patient(patient_details, doctors)
from pydantic import BaseModel
class patients(BaseModel):
id: int
description: str
age: int
name: str
import logging
from fastapi import FastAPI
from scripts.core.handlers.publisher_handler import PublishHandler
from scripts.model.patients import patients
app = FastAPI()
......@@ -11,9 +12,9 @@ def root():
@app.post("/publish", tags=["assign doctor and publish"])
def publish_data():
def publish_data(details: patients):
try:
PublishHandler.main_handler()
PublishHandler.main_handler(details)
except Exception as e:
logging.error(f'assign a doctor and publishing the details failed: {e}')
return {"data": "data published"}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment