Skip to content

Commit

Permalink
copy attributes from reference
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloarocha committed Jan 23, 2025
1 parent 45ccfee commit d7d6bcc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions services/drug_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,18 @@ def create_attributes_from_reference(id_drug, id_segment, user):
def _fill_drug_attributes_from_ref(
reference: Substance, drug_attributes: DrugAttributes, segment: Segment
):
drug_attributes.antimicro = SubstanceTagEnum.ANTIMICRO.value in reference.tags
drug_attributes.mav = SubstanceTagEnum.SURVEILLANCE.value in reference.tags
drug_attributes.controlled = SubstanceTagEnum.CONTROLLED.value in reference.tags
drug_attributes.tube = SubstanceTagEnum.TUBE.value in reference.tags
drug_attributes.chemo = SubstanceTagEnum.CHEMOTERAPY.value in reference.tags
drug_attributes.elderly = SubstanceTagEnum.PIM.value in reference.tags
drug_attributes.whiteList = SubstanceTagEnum.NOT_VALIDATED.value in reference.tags
drug_attributes.dialyzable = SubstanceTagEnum.DIALYZABLE.value in reference.tags
drug_attributes.fasting = SubstanceTagEnum.FASTING.value in reference.tags
if reference.tags:
drug_attributes.antimicro = SubstanceTagEnum.ANTIMICRO.value in reference.tags
drug_attributes.mav = SubstanceTagEnum.SURVEILLANCE.value in reference.tags
drug_attributes.controlled = SubstanceTagEnum.CONTROLLED.value in reference.tags
drug_attributes.tube = SubstanceTagEnum.TUBE.value in reference.tags
drug_attributes.chemo = SubstanceTagEnum.CHEMOTERAPY.value in reference.tags
drug_attributes.elderly = SubstanceTagEnum.PIM.value in reference.tags
drug_attributes.whiteList = (
SubstanceTagEnum.NOT_VALIDATED.value in reference.tags
)
drug_attributes.dialyzable = SubstanceTagEnum.DIALYZABLE.value in reference.tags
drug_attributes.fasting = SubstanceTagEnum.FASTING.value in reference.tags

if segment.type == SegmentTypeEnum.PEDIATRIC.value:
drug_attributes.kidney = reference.kidney_pediatric
Expand Down

0 comments on commit d7d6bcc

Please sign in to comment.