Delete getproblems.py
Browse files- getproblems.py +0 -49
getproblems.py
DELETED
|
@@ -1,49 +0,0 @@
|
|
| 1 |
-
from component.mongoconnection import provideClient
|
| 2 |
-
|
| 3 |
-
mc=provideClient()
|
| 4 |
-
|
| 5 |
-
db=mc["askmydoc_db"]
|
| 6 |
-
coll=db["askmydoc_col"]
|
| 7 |
-
|
| 8 |
-
def GetProblems(owner,typeofmsg,files):
|
| 9 |
-
|
| 10 |
-
match typeofmsg:
|
| 11 |
-
case "legal":
|
| 12 |
-
|
| 13 |
-
document = coll.find_one({"owner": owner})
|
| 14 |
-
|
| 15 |
-
if document is None or "keypoints" not in document or len(document["keypoints"]) == 0:
|
| 16 |
-
return {"problems":[]}
|
| 17 |
-
else:
|
| 18 |
-
filtered=[]
|
| 19 |
-
for msg in document["keypoints"]:
|
| 20 |
-
if msg["type"] == typeofmsg and any(f in files for f in msg["files"]):
|
| 21 |
-
filtered.append(msg)
|
| 22 |
-
|
| 23 |
-
return {"problems":filtered}
|
| 24 |
-
|
| 25 |
-
case "medical":
|
| 26 |
-
document = coll.find_one({"owner": owner})
|
| 27 |
-
|
| 28 |
-
if document is None or "keypoints" not in document or len(document["keypoints"]) == 0:
|
| 29 |
-
return {"problems":[]}
|
| 30 |
-
else:
|
| 31 |
-
filtered=[]
|
| 32 |
-
for msg in document["keypoints"]:
|
| 33 |
-
if msg["type"] == typeofmsg and any(f in files for f in msg["files"]):
|
| 34 |
-
filtered.append(msg)
|
| 35 |
-
|
| 36 |
-
return {"problems":filtered}
|
| 37 |
-
|
| 38 |
-
case "research":
|
| 39 |
-
document = coll.find_one({"owner": owner})
|
| 40 |
-
|
| 41 |
-
if document is None or "keypoints" not in document or len(document["keypoints"]) == 0:
|
| 42 |
-
return {"problems":[]}
|
| 43 |
-
else:
|
| 44 |
-
filtered=[]
|
| 45 |
-
for msg in document["keypoints"]:
|
| 46 |
-
if msg["type"] == typeofmsg and any(f in files for f in msg["files"]):
|
| 47 |
-
filtered.append(msg)
|
| 48 |
-
|
| 49 |
-
return {"problems":filtered}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|