Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

fix(map_priority) : priority starts from 1 and not from 0 #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/custom/map_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class Priority(Enum):
def map_priority(raw_input):
"""Map int to ServiceRequest.priority (0: stat, 1: asap, 2: urgent, 3+ routine)"""
mapping = {
"0": Priority.STAT.value,
"1": Priority.ASAP.value,
"2": Priority.URGENT.value,
"3": Priority.ROUTINE.value,
"1": Priority.STAT.value,
"2": Priority.ASAP.value,
"3": Priority.URGENT.value,
"4": Priority.ROUTINE.value,
}
if str(raw_input) in mapping.keys():
return mapping[str(raw_input)]
else:
return mapping["3"]
return mapping["4"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):

setup(
name="cleaning-scripts",
version="0.2.31",
version="0.2.32",
author="Arkhn",
author_email="[email protected]",
description="Python scripts used in the FHIR integration pipeline "
Expand Down
12 changes: 6 additions & 6 deletions tests/custom/test_map_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

def test_map_priority():

raw_input_1 = "0"
raw_input_1 = "1"
output_1 = custom.map_priority(raw_input_1)
assert output_1 == "stat"

raw_input_2 = 0
raw_input_2 = 1
output_2 = custom.map_priority(raw_input_2)
assert output_2 == "stat"

raw_input_3 = "1"
raw_input_3 = "2"
output_3 = custom.map_priority(raw_input_3)
assert output_3 == "asap"

raw_input_4 = 1
raw_input_4 = 2
output_4 = custom.map_priority(raw_input_4)
assert output_4 == "asap"

raw_input_5 = "2"
raw_input_5 = "3"
output_5 = custom.map_priority(raw_input_5)
assert output_5 == "urgent"

raw_input_6 = 2
raw_input_6 = 3
output_6 = custom.map_priority(raw_input_6)
assert output_6 == "urgent"

Expand Down