Skip to content

Commit 2f78505

Browse files
committed
refactor expression functions: lookup_data
1 parent 845a124 commit 2f78505

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lambdas/shared/src/common/validator/lookup_expressions/lookup_data.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# --------------------------------------------------------------------------------------------------------
2-
# main conversion lookup
1+
"""
2+
Provides human-readable descriptions for coded values such as SNOMED codes.
3+
For LOOKUP expressions to return the text meaning of a code
4+
(e.g., "368208006" -> "Left upper arm structure").
5+
6+
Example:
7+
>>> lookup = LookUpData()
8+
>>> lookup.find_lookup("368208006")
9+
'Left upper arm structure'
10+
"""
311

412

513
class LookUpData:
@@ -9,7 +17,7 @@ class LookUpData:
917

1018
# data settings
1119
def __init__(self):
12-
self.all_data = {
20+
self.all_data: dict[str, str] = {
1321
"368208006": "Left upper arm structure",
1422
"279549004": "Nasal cavity structure",
1523
"74262004": "Oral cavity structure",
@@ -105,7 +113,7 @@ def __init__(self):
105113
}
106114

107115
# Look up the term for the code
108-
def find_lookup(self, field_value):
116+
def find_lookup(self, field_value: str) -> str:
109117
try:
110118
lookup_value = self.all_data[field_value]
111119
except Exception:

0 commit comments

Comments
 (0)