Skip to content

Commit

Permalink
Merge pull request #428 from noharm-ai/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloarocha authored Jan 4, 2025
2 parents 9af8894 + ecda81d commit 8a92af8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Config:
VERSION = "v4.22-beta"
VERSION = "v4.23-beta"
FRONTEND_VERSION = "4.0.14"
ENV = getenv("ENV") or NoHarmENV.DEVELOPMENT.value
SECRET_KEY = getenv("SECRET_KEY") or "secret_key"
Expand Down
48 changes: 25 additions & 23 deletions services/clinical_notes_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,19 @@ def refresh_dialysis_cache(admission_number: int, user_context: User):
redis_client.delete(key)

for d in dialysis:
data = {
"dtevolucao": d.date.isoformat(),
"fkevolucao": d.id,
"lista": d.annotations.get("dialise", []),
}
data_json = json.dumps(data)
timestamp = int(
time.mktime(time.strptime(data["dtevolucao"], "%Y-%m-%dT%H:%M:%S"))
)
redis_client.zadd(key, {data_json: timestamp})
redis_client.zremrangebyscore(key, min=0, max=ten_days_ago)
redis_client.expire(key, (10 * 24 * 60 * 60)) # 10 days
if d.annotations:
data = {
"dtevolucao": d.date.isoformat(),
"fkevolucao": d.id,
"lista": d.annotations.get("dialise", []),
}
data_json = json.dumps(data)
timestamp = int(
time.mktime(time.strptime(data["dtevolucao"], "%Y-%m-%dT%H:%M:%S"))
)
redis_client.zadd(key, {data_json: timestamp})
redis_client.zremrangebyscore(key, min=0, max=ten_days_ago)
redis_client.expire(key, (10 * 24 * 60 * 60)) # 10 days


@has_permission(Permission.WRITE_PRESCRIPTION, Permission.MAINTAINER)
Expand All @@ -453,14 +454,15 @@ def refresh_allergies_cache(admission_number: int, user_context: User):
redis_client.delete(key)

for a in allergies:
data = {
"dtevolucao": a.date.isoformat(),
"fkevolucao": a.id,
"lista": a.annotations.get("allergiesComposed", []),
}
data_json = json.dumps(data)
timestamp = int(
time.mktime(time.strptime(data["dtevolucao"], "%Y-%m-%dT%H:%M:%S"))
)
redis_client.zadd(key, {data_json: timestamp})
redis_client.expire(key, (120 * 24 * 60 * 60)) # 120 days
if a.annotations:
data = {
"dtevolucao": a.date.isoformat(),
"fkevolucao": a.id,
"lista": a.annotations.get("allergiesComposed", []),
}
data_json = json.dumps(data)
timestamp = int(
time.mktime(time.strptime(data["dtevolucao"], "%Y-%m-%dT%H:%M:%S"))
)
redis_client.zadd(key, {data_json: timestamp})
redis_client.expire(key, (120 * 24 * 60 * 60)) # 120 days

0 comments on commit 8a92af8

Please sign in to comment.