Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redis_producer
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
mohammed.shibili
redis_producer
Commits
b2ebebca
Commit
b2ebebca
authored
Feb 02, 2023
by
mohammed.shibili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wild card
parent
2b9b9fe7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
5 deletions
+23
-5
.idea/sonarlint/issuestore/index.pb
+6
-0
conf/app.conf
+5
-0
script/config/end_points.py
+6
-0
script/database/models.py
+1
-2
script/service/main.py
+5
-3
No files found.
.idea/sonarlint/issuestore/index.pb
View file @
b2ebebca
No preview for this file type
conf/app.conf
View file @
b2ebebca
...
...
@@ -8,3 +8,7 @@ redis_db=hospital
mqtt_broker
=
192
.
168
.
0
.
220
mqtt_port
=
1883
mqtt_time
=
60
[
end_points
]
get
=/
doctors
post
=/
patients
\ No newline at end of file
script/config/end_points.py
0 → 100644
View file @
b2ebebca
import
configparser
config
=
configparser
.
RawConfigParser
()
config
.
read
(
"conf/app.conf"
)
get_end
=
config
.
get
(
"end_point"
,
"get"
)
post_end
=
config
.
get
(
"end_point"
,
"post"
)
\ No newline at end of file
script/database/models.py
View file @
b2ebebca
...
...
@@ -5,4 +5,4 @@ class patient_details(BaseModel):
patient_id
:
str
name
:
str
age
:
int
description
:
str
\ No newline at end of file
description
:
str
script/service/main.py
View file @
b2ebebca
import
json
from
fastapi
import
FastAPI
from
script.config.end_points
import
get_end
,
post_end
from
script.core.handlers.mqtt_coo
import
mqtt_conn
from
script.core.handlers.redis_connection
import
redis_connection
from
script.database.models
import
patient_details
...
...
@@ -14,15 +16,15 @@ patient_info = {}
# api call for generating doctors list
@app.get
(
"/doctors"
,
tags
=
[
'REDIS'
])
@app.get
(
get_end
,
tags
=
[
'REDIS'
])
async
def
doctor
(
no_of_doctors
:
int
):
for
doctors
in
range
(
1
,
no_of_doctors
+
1
):
doctors_list
.
append
(
f
'doctor{doctors}'
)
doctors_list
.
append
(
f
'
/
doctor{doctors}'
)
# publishing doctors list to redis
connection_redis
.
lpush
(
"available_doctors"
,
f
'doctor{doctors}'
)
@app.post
(
"/patients"
,
tags
=
[
"REDIS"
])
@app.post
(
post_end
,
tags
=
[
"REDIS"
])
async
def
patients
(
body
:
patient_details
):
global
topic
global
current_doctor
...
...
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