Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MQTT-Redis
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
arjun.b
MQTT-Redis
Commits
1d44d966
Commit
1d44d966
authored
Feb 03, 2023
by
arjun.b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db model added
parent
b9569af7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
scripts/core/handlers/publisher_handler.py
+8
-17
scripts/model/patients.py
+8
-0
scripts/services/publisher.py
+3
-2
No files found.
scripts/core/handlers/publisher_handler.py
View file @
1d44d966
...
@@ -3,21 +3,12 @@ from scripts.core.handlers.assign_patient import assign_patient
...
@@ -3,21 +3,12 @@ from scripts.core.handlers.assign_patient import assign_patient
class
PublishHandler
:
class
PublishHandler
:
@staticmethod
@staticmethod
def
main_handler
():
def
main_handler
(
details
):
doctors
=
[
'Dr. Smith'
,
'Dr. Johnson'
,
'Dr. Brown'
,
"Dr. Arjun B"
]
doctors
=
[
'Dr. Smith'
,
'Dr. Johnson'
,
'Dr. Brown'
,
"Dr. Arjun B"
]
i
=
1
patient_details
=
{
while
i
:
"patient_id"
:
details
.
id
,
print
(
"--------Consult a Doctor------
\n
"
)
"description"
:
details
.
description
,
choice
=
int
(
input
(
"Enter your choice:"
))
"age"
:
details
.
age
,
if
choice
==
1
:
"name"
:
details
.
name
patient_id
=
input
(
"Enter patient id: "
)
}
description
=
input
(
"Enter the description: "
)
assign_patient
(
patient_details
,
doctors
)
age
=
int
(
input
(
"Enter the age: "
))
name
=
input
(
"Enter the name: "
)
patient_details
=
{
"patient_id"
:
patient_id
,
"description"
:
description
,
"age"
:
age
,
"name"
:
name
}
assign_patient
(
patient_details
,
doctors
)
scripts/model/patients.py
0 → 100644
View file @
1d44d966
from
pydantic
import
BaseModel
class
patients
(
BaseModel
):
id
:
int
description
:
str
age
:
int
name
:
str
scripts/services/publisher.py
View file @
1d44d966
import
logging
import
logging
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
scripts.core.handlers.publisher_handler
import
PublishHandler
from
scripts.core.handlers.publisher_handler
import
PublishHandler
from
scripts.model.patients
import
patients
app
=
FastAPI
()
app
=
FastAPI
()
...
@@ -11,9 +12,9 @@ def root():
...
@@ -11,9 +12,9 @@ def root():
@app.post
(
"/publish"
,
tags
=
[
"assign doctor and publish"
])
@app.post
(
"/publish"
,
tags
=
[
"assign doctor and publish"
])
def
publish_data
():
def
publish_data
(
details
:
patients
):
try
:
try
:
PublishHandler
.
main_handler
()
PublishHandler
.
main_handler
(
details
)
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
error
(
f
'assign a doctor and publishing the details failed: {e}'
)
logging
.
error
(
f
'assign a doctor and publishing the details failed: {e}'
)
return
{
"data"
:
"data published"
}
return
{
"data"
:
"data published"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment