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

@ -5,7 +5,7 @@ import Apikeys
import json
APIKEY = Apikeys.ANTHOLOGY
APIKEY = Apikeys.SANDATA
groups_dict = {}
pp = pprint.PrettyPrinter(indent=4)
@ -27,16 +27,17 @@ def get_groups(APIKEY):
# if created_at.startswith("2023"):
group_id = response["id"]
group_name = response["attributes"]["name"]
# print(group_name)
groups_dict = {group_name: group_id}
groups.append(groups_dict)
if "caregiver" in group_name:
# print(group_name)
groups_dict = {group_name: group_id}
groups.append(groups_dict)
if "next" not in nextlink:
break
print(groups)
with open(
"/Users/normrasmussen/Downloads/Anthology-Groups.csv", "a+", newline="\n"
"/Users/normrasmussen/Downloads/Sandata-Groups.csv", "a+", newline="\n"
) as csvfile:
for group in groups:
for key, value in group.items():

View File

@ -60,3 +60,28 @@ REF = [
("WI", "ST - WI Alt EVV Aggregator", "d82dae5a-c11d-4063-bd24-711af2861655"),
("WI", "ST - WI Non-Agency EVV", "ac69b41e-1c8c-4904-8a4b-e61c5b5faa00"),
]
CG = [
("AZ", "CG - AZ", "5786b31f-0721-4152-aa09-dd257ba1e335"),
("CA", "CG - CA", "18d5b3af-d0a9-4467-a782-72e0b6f0b6ff"),
("CO", "CG - CO", "e8839b51-c3b9-4b60-b513-562dca87d17b"),
("CT", "CG - CT", "935a2632-7d1e-464f-b7b8-f6931a714102"),
("DC", "CG - DC", "4f87523d-cc61-4dbe-bb6f-147772aa40a8"),
("DE", "CG - DE", "003d1614-3fb0-4c2e-ad89-ce1695348720"),
("HI", "CG - HI", "266791a2-2cec-4121-956f-91c758ac8344"),
("ID", "CG - ID", "b76e260c-1ee6-4a40-983b-cad3c02ff236"),
("IL", "CG - IL", "9e94ea7b-6e66-4e72-99fe-4fa7948aa1f9"),
("IN", "CG - IN", "8889a294-5dd0-4e27-a6af-96e212ca78b9"),
("MA", "CG - MA", "2b29a6c3-ab9e-4855-9150-b7d786263eee"),
("MO", "CG - MO", "263cd2c8-cccb-46a4-a018-5006685665c4"),
("NC", "CG - NC", "28812e6a-d0c7-4f63-a4b6-e8d1a2280c11"),
("ND", "CG - ND", "a73d23c6-d12e-4e4a-bf16-118670fc6d0e"),
("NV", "CG - NV", "64f7aaac-419e-4c22-8c75-75dd0ebfd75b"),
("OH", "CG - OH", "74512300-e65c-470e-804b-98dc1416bc49"),
("PA", "CG - PA", "415cc076-059e-4fe8-9723-cd74433da389"),
("RI", "CG - RI", "c552a8d6-e070-4b85-8dde-79dd6cb0c642"),
("TN", "CG - TN", "2e65a1bd-948e-41d5-b675-b580db690db2"),
("WI", "CG - WI", "27e6b7dd-e699-4f9a-9af0-4edf1ac8a82c"),
("VT", "CG - VT", "9c2e85c7-433f-4e7a-9baf-a05c2b12d545"),
]

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()