Sandata Workato Scripts.

This commit is contained in:
Norm Rasmussen
2024-06-18 16:31:27 -04:00
parent a8ac05e460
commit 06af9a492e
6 changed files with 177 additions and 17 deletions

View File

@ -31,7 +31,7 @@ webhook_payload = {
"agency_id": "Test 2",
"medicaid_id": "54321",
"provider_id": "0987654321",
"learner_role": "Agency Billing",
"learner_role": "CG",
"learner_state": "TN",
"evv_radio_selection": "Agency EVV",
"successfully_completed_secondary_registration": True,
@ -62,20 +62,32 @@ webhook_payload = {
# pass
# finally:
# return {"group_uuid": group_uuid}
#
# # The one used in production
# for item in webhook_payload['payload']['array']:
# evv = item['attributes']['properties']['evv_radio_selection']
# state = item['attributes']['properties']['learner_state']
# id_pair = f"{state} {evv}"
# group_result = [ref_state for ref_state in tmp.REF if state in ref_state]
# if len(group_result) > 1:
# for group in group_result:
# if id_pair in group[1]:
# group_uuid = group[2]
# print(group_uuid)
# else:
# group_uuid = group_result[0][2]
# print(group_uuid)
# The one for Caregivers
for item in webhook_payload['payload']['array']:
evv = item['attributes']['properties']['evv_radio_selection']
role = item['attributes']['properties']['learner_role']
state = item['attributes']['properties']['learner_state']
id_pair = f"{state} {evv}"
group_result = [ref_state for ref_state in tmp.REF if state in ref_state]
if len(group_result) > 1:
for group in group_result:
if id_pair in group[1]:
group_uuid = group[2]
print(group_uuid)
else:
id_pair = f"{role} - {state}"
group_result = [ref_state for ref_state in tmp.CG if state in ref_state]
if group_result[0][1] == id_pair:
group_uuid = group_result[0][2]
print(group_uuid)
# group_uuid = group_result[0][2]
# if __name__ == "__main__":
# # main()