Skip to content

Commit

Permalink
Merge pull request #404 from noharm-ai/develop
Browse files Browse the repository at this point in the history
v4.05-beta
  • Loading branch information
marceloarocha authored Oct 30, 2024
2 parents 1b7c43f + 7cad6be commit e4683a4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 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.04-beta"
VERSION = "v4.05-beta"
FRONTEND_VERSION = "4.0.4"
ENV = getenv("ENV") or NoHarmENV.DEVELOPMENT.value
SECRET_KEY = getenv("SECRET_KEY") or "secret_key"
Expand Down
1 change: 1 addition & 0 deletions models/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class Drug(db.Model):
name = db.Column("nome", db.String, nullable=False)
sctid = db.Column("sctid", db.BigInteger, nullable=True)
ai_accuracy = db.Column("ia_acuracia", db.Float, nullable=True)
source = db.Column("origem", db.String, nullable=True)
created_by = db.Column("created_by", db.BigInteger, nullable=True)
updated_by = db.Column("updated_by", db.BigInteger, nullable=True)
created_at = db.Column("created_at", db.DateTime, nullable=False)
Expand Down
1 change: 1 addition & 0 deletions routes/admin/admin_drug.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def get_drug_list():
substance=request_data.get("substance", None),
id_segment_list=request_data.get("idSegmentList", None),
has_max_dose=request_data.get("hasMaxDose", None),
source_list=request_data.get("sourceList", []),
limit=request_data.get("limit", 10),
offset=request_data.get("offset", 0),
)
Expand Down
4 changes: 4 additions & 0 deletions services/admin/admin_drug_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def get_drug_list(
has_ai_substance=None,
ai_accuracy_range=None,
has_max_dose=None,
source_list=None,
):
SegmentOutlier = db.aliased(Segment)
ConversionsAgg = db.aliased(MeasureUnitConvert)
Expand Down Expand Up @@ -223,6 +224,9 @@ def get_drug_list(
if id_segment_list and len(id_segment_list) > 0:
q = q.filter(DrugAttributes.idSegment.in_(id_segment_list))

if source_list and len(source_list) > 0:
q = q.filter(Drug.source.in_(source_list))

return q.order_by(Drug.name, Segment.description).limit(limit).offset(offset).all()


Expand Down
11 changes: 10 additions & 1 deletion services/alert_interaction_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sqlalchemy import text
from typing import List

from models.prescription import PrescriptionDrug
from models.prescription import PrescriptionDrug, DrugAttributes
from models.main import db, Drug, Substance, Allergy
from models.enums import DrugTypeEnum, DrugAlertLevelEnum
from utils import examutils, stringutils
Expand Down Expand Up @@ -219,7 +219,9 @@ def _filter_drug_list(drug_list):

for item in drug_list:
prescription_drug: PrescriptionDrug = item[0]
drug_attributes: DrugAttributes = item[6]
drug: Drug = item[1]

if prescription_drug.source not in valid_sources:
continue

Expand All @@ -229,6 +231,13 @@ def _filter_drug_list(drug_list):
if drug == None or drug.sctid == None:
continue

if (
drug_attributes != None
and drug_attributes.whiteList
and not prescription_drug.source == DrugTypeEnum.SOLUTION.value
):
continue

filtered_list.append(item)

return filtered_list
Expand Down

0 comments on commit e4683a4

Please sign in to comment.