eliminated some hardcoded values

This commit is contained in:
2025-04-17 17:16:01 +01:00
parent 0268bbd557
commit d2e272e44b
8 changed files with 145 additions and 9 deletions
+16
View File
@@ -0,0 +1,16 @@
def preprocess_loan_charges_data(data):
"""
Preprocesses the data into a dictionary for efficient lookups by 'code'.
Args:
data: A list of dictionaries.
Returns:
A dictionary where keys are 'code' values and values are the corresponding dictionaries from the input data.
If multiple items have the same code, the last one encountered will be stored.
"""
preprocessed = {}
for item in data:
if 'code' in item:
preprocessed[item['code']] = item
return preprocessed