medicafe 0.250813.2__py3-none-any.whl → 0.250814.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- MediBot/MediBot.bat +1 -1
- MediBot/MediBot.py +1 -1
- MediBot/MediBot_Preprocessor_lib.py +21 -5
- MediBot/MediBot_UI.py +13 -1
- MediBot/__init__.py +1 -1
- MediBot/update_medicafe.py +69 -7
- MediCafe/__init__.py +1 -1
- MediLink/__init__.py +1 -1
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/METADATA +1 -1
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/RECORD +14 -27
- MediBot/MediPost.py +0 -5
- MediBot/PDF_to_CSV_Cleaner.py +0 -211
- MediLink/MediLink.py +0 -623
- MediLink/MediLink_277_decoder.py +0 -92
- MediLink/MediLink_API_v2.py +0 -176
- MediLink/MediLink_API_v3.py +0 -910
- MediLink/MediLink_APIs.py +0 -138
- MediLink/MediLink_ConfigLoader.py +0 -87
- MediLink/MediLink_ERA_decoder.py +0 -192
- MediLink/MediLink_GraphQL.py +0 -445
- MediLink/MediLink_StatusCheck.py +0 -0
- MediLink/MediLink_api_utils.py +0 -305
- MediLink/MediLink_batch.bat +0 -7
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/LICENSE +0 -0
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/WHEEL +0 -0
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/entry_points.txt +0 -0
- {medicafe-0.250813.2.dist-info → medicafe-0.250814.3.dist-info}/top_level.txt +0 -0
MediLink/MediLink_GraphQL.py
DELETED
@@ -1,445 +0,0 @@
|
|
1
|
-
# MediLink_GraphQL.py
|
2
|
-
"""
|
3
|
-
GraphQL module for United Healthcare Super Connector API
|
4
|
-
Handles query templates, query building, and response transformations
|
5
|
-
"""
|
6
|
-
|
7
|
-
import json
|
8
|
-
|
9
|
-
class GraphQLQueryBuilder:
|
10
|
-
"""Builder class for constructing GraphQL queries for Super Connector API"""
|
11
|
-
|
12
|
-
@staticmethod
|
13
|
-
def get_eligibility_query() -> str:
|
14
|
-
"""
|
15
|
-
Returns the GraphQL query for eligibility checks.
|
16
|
-
Uses the exact working format from the successful cURL request.
|
17
|
-
"""
|
18
|
-
return GraphQLQueryBuilder.get_working_eligibility_query()
|
19
|
-
|
20
|
-
@staticmethod
|
21
|
-
def build_eligibility_variables(
|
22
|
-
member_id,
|
23
|
-
first_name=None,
|
24
|
-
last_name=None,
|
25
|
-
date_of_birth=None,
|
26
|
-
service_start_date=None,
|
27
|
-
service_end_date=None,
|
28
|
-
coverage_types=None,
|
29
|
-
payer_id=None,
|
30
|
-
provider_last_name=None,
|
31
|
-
provider_first_name=None,
|
32
|
-
provider_npi=None,
|
33
|
-
group_number=None,
|
34
|
-
trn_id=None,
|
35
|
-
service_level_codes=None,
|
36
|
-
plan_start_date=None,
|
37
|
-
plan_end_date=None,
|
38
|
-
family_indicator=None
|
39
|
-
):
|
40
|
-
"""
|
41
|
-
Builds the variables object for the eligibility GraphQL query.
|
42
|
-
Uses the exact format that works with the Super Connector API.
|
43
|
-
|
44
|
-
Args:
|
45
|
-
member_id: Unique identifier for the member
|
46
|
-
first_name: First name of the member (not used in working format)
|
47
|
-
last_name: Last name of the member (not used in working format)
|
48
|
-
date_of_birth: Date of birth in ISO 8601 format (YYYY-MM-DD)
|
49
|
-
service_start_date: Start date of the service (not used in working format)
|
50
|
-
service_end_date: End date of the service (not used in working format)
|
51
|
-
coverage_types: Types of coverage (not used in working format)
|
52
|
-
payer_id: Payer identifier
|
53
|
-
provider_last_name: Last name of the provider
|
54
|
-
provider_first_name: First name of the provider (not used in working format)
|
55
|
-
provider_npi: National Provider Identifier (NPI) of the provider
|
56
|
-
group_number: Group number (not used in working format)
|
57
|
-
trn_id: Transaction identifier (not used in working format)
|
58
|
-
service_level_codes: Service level codes (not used in working format)
|
59
|
-
plan_start_date: Start date of the plan (not used in working format)
|
60
|
-
plan_end_date: End date of the plan (not used in working format)
|
61
|
-
family_indicator: Indicator for family/individual (not used in working format)
|
62
|
-
|
63
|
-
Returns:
|
64
|
-
Dictionary containing the variables for the GraphQL query in working format
|
65
|
-
"""
|
66
|
-
# Build variables in the exact format that works with the API
|
67
|
-
variables = {
|
68
|
-
"memberId": member_id,
|
69
|
-
"firstName": "", # Always empty string in working format
|
70
|
-
"lastName": "", # Always empty string in working format
|
71
|
-
"dateOfBirth": date_of_birth,
|
72
|
-
"coverageTypes": [], # Always empty array in working format
|
73
|
-
"payerId": payer_id,
|
74
|
-
"providerFirstName": "", # Always empty string in working format
|
75
|
-
"providerLastName": provider_last_name,
|
76
|
-
"providerNPI": str(provider_npi) if provider_npi else None,
|
77
|
-
# Required empty fields from working format
|
78
|
-
"groupNumber": "",
|
79
|
-
"serviceLevelCodes": [],
|
80
|
-
"planStartDate": "",
|
81
|
-
"planEndDate": "",
|
82
|
-
"familyIndicator": "",
|
83
|
-
"trnId": ""
|
84
|
-
}
|
85
|
-
|
86
|
-
# Remove None values but keep empty strings and arrays
|
87
|
-
variables = {k: v for k, v in variables.items() if v is not None}
|
88
|
-
|
89
|
-
return variables
|
90
|
-
|
91
|
-
@staticmethod
|
92
|
-
def build_eligibility_request(variables):
|
93
|
-
"""
|
94
|
-
Builds the complete GraphQL request body for eligibility checks.
|
95
|
-
Uses the working query format.
|
96
|
-
|
97
|
-
Args:
|
98
|
-
variables: Variables dictionary for the GraphQL query
|
99
|
-
|
100
|
-
Returns:
|
101
|
-
Complete GraphQL request body
|
102
|
-
"""
|
103
|
-
return GraphQLQueryBuilder.build_working_eligibility_request(variables)
|
104
|
-
|
105
|
-
@staticmethod
|
106
|
-
def get_sample_eligibility_request():
|
107
|
-
"""
|
108
|
-
Returns the sample GraphQL request from the swagger documentation.
|
109
|
-
This is for testing purposes to verify the endpoint is working.
|
110
|
-
"""
|
111
|
-
return {
|
112
|
-
"query": "query Query($input: EligibilityInput!) { checkEligibility(input: $input) { eligibility { eligibilityInfo { trnId member { memberId firstName lastName middleName suffix dateOfBirth gender relationship relationshipCode relationshipTypeCode individualRelationshipCode dependentSequenceNumber } contact { addresses { type street1 street2 city state country zip zip4 } } insuranceInfo { policyNumber eligibilityStartDate eligibilityEndDate planStartDate planEndDate policyStatus planTypeDescription planVariation reportingCode stateOfIssueCode productType productId productCode payerId lineOfBusiness lineOfBusinessCode coverageTypes { typeCode description } } associatedIds { alternateId medicaidRecipientId exchangeMemberId alternateSubscriberId hicNumber mbiNumber subscriberMemberFacingIdentifier survivingSpouseId subscriberId memberReplacementId legacyMemberId customerAccountIdentifier } planLevels { level family { networkStatus planAmount planAmountFrequency remainingAmount } individual { networkStatus planAmount planAmountFrequency remainingAmount } } delegatedInfo { entity payerId contact { phone fax email } addresses { type street1 street2 city state country zip zip4 } } additionalInfo { isReferralRequired } } primaryCarePhysician { isPcpFound lastName firstName middleName phoneNumber address { type street1 street2 city state country zip zip4 } networkStatusCode affiliateHospitalName providerGroupName } coordinationOfBenefit { coordinationOfBenefitDetails { payer { name phoneNumber address { type street1 street2 city state country zip zip4 } } cobPrimacy { indicator description message } } uhgPrimacyStatus { policyEffectiveDate policyTerminationDate primacy { indicator description message } } } idCardImages { side content contentType } providerNetwork { status tier } extendedAttributes { fundingCode fundingType hsa cdhp governmentProgramCode cmsPackageBenefitPlanCode cmsSegmentId cmsContractId marketType obligorId marketSite benefitPlanId virtualVisit planVariation groupNumber legacyPanelNumber coverageLevel sharedArrangement productServiceCode designatedVirtualClinicNetwork medicaidVariableCode healthInsuranceExchangeId memberDiv legalEntityCode } otherBeneficiaries { memberId firstName lastName middleName suffix dateOfBirth gender relationship relationshipCode relationshipTypeCode individualRelationshipCode dependentSequenceNumber } serviceLevels { family { networkStatus services { isVendorOnly service serviceCode serviceDate text status coPayAmount coPayFrequency coInsurancePercent planAmount remainingAmount metYearToDateAmount isReferralObtainedCopay isReferralObtainedCoInsurance referralCopayAmount referralCoInsurancePercent benefitsAllowedFrequencies benefitsRemainingFrequencies message { note { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coPay { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coInsurance { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } deductible { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } benefitsAllowed { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } benefitsRemaining { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coPayList coInsuranceList } } } individual { networkStatus services { isVendorOnly service serviceCode serviceDate text status coPayAmount coPayFrequency coInsurancePercent planAmount remainingAmount metYearToDateAmount isReferralObtainedCopay isReferralObtainedCoInsurance referralCopayAmount referralCoInsurancePercent benefitsAllowedFrequencies benefitsRemainingFrequencies message { note { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coPay { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coInsurance { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } deductible { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } benefitsAllowed { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } benefitsRemaining { isSingleMessageDetail isViewDetail messages text subMessages { service status copay msg startDate endDate minCopay minCopayMsg maxCopay maxCopayMsg isPrimaryIndicator } limitationInfo { lmtPeriod lmtType lmtOccurPerPeriod lmtDollarPerPeriod message } isMultipleCopaysFound isMultipleCoinsuranceFound } coPayList coInsuranceList } } } } } } }",
|
113
|
-
"variables": {
|
114
|
-
"input": {
|
115
|
-
"memberId": "0001234567",
|
116
|
-
"firstName": "ABC",
|
117
|
-
"lastName": "EFGH",
|
118
|
-
"dateOfBirth": "YYYY-MM-DD",
|
119
|
-
"serviceStartDate": "YYYY-MM-DD",
|
120
|
-
"serviceEndDate": "YYYY-MM-DD",
|
121
|
-
"coverageTypes": [
|
122
|
-
"Medical"
|
123
|
-
],
|
124
|
-
"payerId": "12345",
|
125
|
-
"providerLastName": "XYZ",
|
126
|
-
"providerFirstName": "QWERT",
|
127
|
-
"providerNPI": "1234567890",
|
128
|
-
"groupNumber": "",
|
129
|
-
"serviceLevelCodes": [],
|
130
|
-
"planStartDate": "",
|
131
|
-
"planEndDate": "",
|
132
|
-
"familyIndicator": "",
|
133
|
-
"trnId": ""
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
@staticmethod
|
139
|
-
def get_working_eligibility_query():
|
140
|
-
"""
|
141
|
-
Returns the exact GraphQL query format that works with the Super Connector API.
|
142
|
-
This matches the exact format from the successful cURL request.
|
143
|
-
"""
|
144
|
-
return """query Query($input: EligibilityInput!) {\r\n \r\n checkEligibility(input: $input) {\r\n eligibility {\r\n eligibilityInfo {\r\n trnId\r\n member {\r\n memberId\r\n firstName\r\n lastName\r\n middleName\r\n suffix\r\n dateOfBirth\r\n gender\r\n relationship\r\n relationshipCode\r\n relationshipTypeCode\r\n individualRelationshipCode\r\n dependentSequenceNumber\r\n }\r\n contact {\r\n addresses {\r\n type\r\n street1\r\n street2\r\n city\r\n state\r\n country\r\n zip\r\n zip4\r\n }\r\n }\r\n insuranceInfo {\r\n policyNumber\r\n eligibilityStartDate\r\n eligibilityEndDate\r\n planStartDate\r\n planEndDate\r\n policyStatus\r\n planTypeDescription\r\n planVariation\r\n reportingCode\r\n stateOfIssueCode\r\n productType\r\n productId\r\n productCode\r\n payerId\r\n lineOfBusiness\r\n lineOfBusinessCode\r\n coverageTypes {\r\n typeCode\r\n description\r\n }\r\n }\r\n associatedIds {\r\n alternateId\r\n medicaidRecipientId\r\n exchangeMemberId\r\n alternateSubscriberId\r\n hicNumber\r\n mbiNumber\r\n subscriberMemberFacingIdentifier\r\n survivingSpouseId\r\n subscriberId\r\n memberReplacementId\r\n legacyMemberId\r\n customerAccountIdentifier\r\n }\r\n planLevels {\r\n level\r\n family {\r\n networkStatus\r\n planAmount\r\n planAmountFrequency\r\n remainingAmount\r\n }\r\n individual {\r\n networkStatus\r\n planAmount\r\n planAmountFrequency\r\n remainingAmount\r\n }\r\n }\r\n delegatedInfo {\r\n entity\r\n payerId\r\n contact {\r\n phone\r\n fax\r\n email\r\n }\r\n addresses {\r\n type\r\n street1\r\n street2\r\n city\r\n state\r\n country\r\n zip\r\n zip4\r\n }\r\n }\r\n additionalInfo {\r\n isReferralRequired\r\n }\r\n }\r\n primaryCarePhysician {\r\n isPcpFound\r\n lastName\r\n firstName\r\n middleName\r\n phoneNumber\r\n address {\r\n type\r\n street1\r\n street2\r\n city\r\n state\r\n country\r\n zip\r\n zip4\r\n }\r\n networkStatusCode\r\n affiliateHospitalName\r\n providerGroupName\r\n }\r\n coordinationOfBenefit {\r\n coordinationOfBenefitDetails {\r\n payer {\r\n name\r\n phoneNumber\r\n address {\r\n type\r\n street1\r\n street2\r\n city\r\n state\r\n country\r\n zip\r\n zip4\r\n }\r\n }\r\n cobPrimacy {\r\n indicator\r\n description\r\n message\r\n }\r\n }\r\n uhgPrimacyStatus {\r\n policyEffectiveDate\r\n policyTerminationDate\r\n primacy {\r\n indicator\r\n description\r\n message\r\n }\r\n }\r\n }\r\n providerNetwork {\r\n status\r\n tier\r\n }\r\n extendedAttributes {\r\n fundingCode\r\n fundingType\r\n hsa\r\n cdhp\r\n governmentProgramCode\r\n cmsPackageBenefitPlanCode\r\n cmsSegmentId\r\n cmsContractId\r\n marketType\r\n obligorId\r\n marketSite\r\n benefitPlanId\r\n virtualVisit\r\n planVariation\r\n groupNumber\r\n legacyPanelNumber\r\n coverageLevel\r\n sharedArrangement\r\n productServiceCode\r\n designatedVirtualClinicNetwork\r\n medicaidVariableCode\r\n healthInsuranceExchangeId\r\n memberDiv\r\n legalEntityCode\r\n }\r\n otherBeneficiaries {\r\n memberId\r\n firstName\r\n lastName\r\n middleName\r\n suffix\r\n dateOfBirth\r\n gender\r\n relationship\r\n relationshipCode\r\n relationshipTypeCode\r\n individualRelationshipCode\r\n dependentSequenceNumber\r\n }\r\n serviceLevels {\r\n family {\r\n networkStatus\r\n services {\r\n isVendorOnly\r\n service\r\n serviceCode\r\n serviceDate\r\n text\r\n status\r\n coPayAmount\r\n coPayFrequency\r\n coInsurancePercent\r\n planAmount\r\n remainingAmount\r\n metYearToDateAmount\r\n isReferralObtainedCopay\r\n isReferralObtainedCoInsurance\r\n referralCopayAmount\r\n referralCoInsurancePercent\r\n benefitsAllowedFrequencies\r\n benefitsRemainingFrequencies\r\n message {\r\n note {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coPay {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coInsurance {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n deductible {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n benefitsAllowed {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n benefitsRemaining {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coPayList\r\n coInsuranceList\r\n }\r\n }\r\n }\r\n individual {\r\n networkStatus\r\n services {\r\n isVendorOnly\r\n service\r\n serviceCode\r\n serviceDate\r\n text\r\n status\r\n coPayAmount\r\n coPayFrequency\r\n coInsurancePercent\r\n planAmount\r\n remainingAmount\r\n metYearToDateAmount\r\n isReferralObtainedCopay\r\n isReferralObtainedCoInsurance\r\n referralCopayAmount\r\n referralCoInsurancePercent\r\n benefitsAllowedFrequencies\r\n benefitsRemainingFrequencies\r\n message {\r\n note {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coPay {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coInsurance {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n deductible {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n benefitsAllowed {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n benefitsRemaining {\r\n isSingleMessageDetail\r\n isViewDetail\r\n messages\r\n text\r\n subMessages {\r\n service\r\n status\r\n copay\r\n msg\r\n startDate\r\n endDate\r\n minCopay\r\n minCopayMsg\r\n maxCopay\r\n maxCopayMsg\r\n isPrimaryIndicator\r\n }\r\n limitationInfo {\r\n lmtPeriod\r\n lmtType\r\n lmtOccurPerPeriod\r\n lmtDollarPerPeriod\r\n message\r\n }\r\n isMultipleCopaysFound\r\n isMultipleCoinsuranceFound\r\n }\r\n coPayList\r\n coInsuranceList\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}"""
|
145
|
-
|
146
|
-
@staticmethod
|
147
|
-
def build_working_eligibility_request(variables):
|
148
|
-
"""
|
149
|
-
Builds the complete GraphQL request body using the working query format.
|
150
|
-
|
151
|
-
Args:
|
152
|
-
variables: Variables dictionary for the GraphQL query
|
153
|
-
|
154
|
-
Returns:
|
155
|
-
Complete GraphQL request body with working query format
|
156
|
-
"""
|
157
|
-
return {
|
158
|
-
"query": GraphQLQueryBuilder.get_working_eligibility_query(),
|
159
|
-
"variables": {
|
160
|
-
"input": variables
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
class GraphQLResponseTransformer:
|
165
|
-
"""Transforms GraphQL responses to match REST API format"""
|
166
|
-
|
167
|
-
@staticmethod
|
168
|
-
def transform_eligibility_response(graphql_response):
|
169
|
-
"""
|
170
|
-
Transforms the GraphQL eligibility response to match the REST API format.
|
171
|
-
This ensures the calling code receives the same structure regardless of endpoint.
|
172
|
-
|
173
|
-
Args:
|
174
|
-
graphql_response: Raw GraphQL response from Super Connector API
|
175
|
-
|
176
|
-
Returns:
|
177
|
-
Transformed response matching REST API format
|
178
|
-
"""
|
179
|
-
try:
|
180
|
-
# Check for authentication errors first
|
181
|
-
if 'errors' in graphql_response:
|
182
|
-
error = graphql_response['errors'][0]
|
183
|
-
error_code = error.get('extensions', {}).get('code', 'UNKNOWN_ERROR')
|
184
|
-
error_message = error.get('message', 'Unknown error')
|
185
|
-
|
186
|
-
if error_code == 'UNAUTHORIZED_AUTHENTICATION_FAILED':
|
187
|
-
return {
|
188
|
-
'statuscode': '401',
|
189
|
-
'message': 'Authentication failed: {}'.format(error_message),
|
190
|
-
'rawGraphQLResponse': graphql_response
|
191
|
-
}
|
192
|
-
else:
|
193
|
-
return {
|
194
|
-
'statuscode': '500',
|
195
|
-
'message': 'GraphQL error: {} - {}'.format(error_code, error_message),
|
196
|
-
'rawGraphQLResponse': graphql_response
|
197
|
-
}
|
198
|
-
|
199
|
-
# Check if GraphQL response has data
|
200
|
-
if 'data' not in graphql_response:
|
201
|
-
return {
|
202
|
-
'statuscode': '404',
|
203
|
-
'message': 'No data found in GraphQL response',
|
204
|
-
'rawGraphQLResponse': graphql_response
|
205
|
-
}
|
206
|
-
|
207
|
-
if 'checkEligibility' not in graphql_response['data']:
|
208
|
-
return {
|
209
|
-
'statuscode': '404',
|
210
|
-
'message': 'No eligibility data found in GraphQL response',
|
211
|
-
'rawGraphQLResponse': graphql_response
|
212
|
-
}
|
213
|
-
|
214
|
-
# Handle case where checkEligibility is null (authentication failure)
|
215
|
-
if graphql_response['data']['checkEligibility'] is None:
|
216
|
-
return {
|
217
|
-
'statuscode': '401',
|
218
|
-
'message': 'Authentication failed - checkEligibility returned null',
|
219
|
-
'rawGraphQLResponse': graphql_response
|
220
|
-
}
|
221
|
-
|
222
|
-
eligibility_data = graphql_response['data']['checkEligibility']['eligibility']
|
223
|
-
if not eligibility_data:
|
224
|
-
return {
|
225
|
-
'statuscode': '404',
|
226
|
-
'message': 'No eligibility records found',
|
227
|
-
'rawGraphQLResponse': graphql_response
|
228
|
-
}
|
229
|
-
|
230
|
-
# Take the first eligibility record (assuming single member query)
|
231
|
-
first_eligibility = eligibility_data[0]
|
232
|
-
eligibility_info = first_eligibility.get('eligibilityInfo', {})
|
233
|
-
|
234
|
-
# Transform to REST-like format
|
235
|
-
rest_response = {
|
236
|
-
'statuscode': '200',
|
237
|
-
'message': 'Eligibility found',
|
238
|
-
'rawGraphQLResponse': graphql_response # Include original response for debugging
|
239
|
-
}
|
240
|
-
|
241
|
-
# Safely extract member information
|
242
|
-
member_info = eligibility_info.get('member', {})
|
243
|
-
if member_info:
|
244
|
-
rest_response.update({
|
245
|
-
'memberId': member_info.get('memberId'),
|
246
|
-
'firstName': member_info.get('firstName'),
|
247
|
-
'lastName': member_info.get('lastName'),
|
248
|
-
'middleName': member_info.get('middleName'),
|
249
|
-
'suffix': member_info.get('suffix'),
|
250
|
-
'dateOfBirth': member_info.get('dateOfBirth'),
|
251
|
-
'gender': member_info.get('gender'),
|
252
|
-
'relationship': member_info.get('relationship'),
|
253
|
-
'relationshipCode': member_info.get('relationshipCode'),
|
254
|
-
'individualRelationshipCode': member_info.get('individualRelationshipCode'),
|
255
|
-
'dependentSequenceNumber': member_info.get('dependentSequenceNumber')
|
256
|
-
})
|
257
|
-
|
258
|
-
# Safely extract insurance information
|
259
|
-
insurance_info = eligibility_info.get('insuranceInfo', {})
|
260
|
-
if insurance_info:
|
261
|
-
rest_response.update({
|
262
|
-
'policyNumber': insurance_info.get('policyNumber'),
|
263
|
-
'eligibilityStartDate': insurance_info.get('eligibilityStartDate'),
|
264
|
-
'eligibilityEndDate': insurance_info.get('eligibilityEndDate'),
|
265
|
-
'planStartDate': insurance_info.get('planStartDate'),
|
266
|
-
'planEndDate': insurance_info.get('planEndDate'),
|
267
|
-
'policyStatus': insurance_info.get('policyStatus'),
|
268
|
-
'planTypeDescription': insurance_info.get('planTypeDescription'),
|
269
|
-
'planVariation': insurance_info.get('planVariation'),
|
270
|
-
'reportingCode': insurance_info.get('reportingCode'),
|
271
|
-
'stateOfIssueCode': insurance_info.get('stateOfIssueCode'),
|
272
|
-
'productType': insurance_info.get('productType'),
|
273
|
-
'productId': insurance_info.get('productId'),
|
274
|
-
'productCode': insurance_info.get('productCode'),
|
275
|
-
'lineOfBusiness': insurance_info.get('lineOfBusiness'),
|
276
|
-
'lineOfBusinessCode': insurance_info.get('lineOfBusinessCode'),
|
277
|
-
'coverageTypes': insurance_info.get('coverageTypes', [])
|
278
|
-
})
|
279
|
-
|
280
|
-
# Safely extract associated IDs
|
281
|
-
associated_ids = eligibility_info.get('associatedIds', {})
|
282
|
-
if associated_ids:
|
283
|
-
rest_response.update({
|
284
|
-
'alternateId': associated_ids.get('alternateId'),
|
285
|
-
'medicaidRecipientId': associated_ids.get('medicaidRecipientId'),
|
286
|
-
'exchangeMemberId': associated_ids.get('exchangeMemberId'),
|
287
|
-
'alternateSubscriberId': associated_ids.get('alternateSubscriberId'),
|
288
|
-
'hicNumber': associated_ids.get('hicNumber'),
|
289
|
-
'mbiNumber': associated_ids.get('mbiNumber'),
|
290
|
-
'subscriberMemberFacingIdentifier': associated_ids.get('subscriberMemberFacingIdentifier'),
|
291
|
-
'survivingSpouseId': associated_ids.get('survivingSpouseId'),
|
292
|
-
'subscriberId': associated_ids.get('subscriberId'),
|
293
|
-
'memberReplacementId': associated_ids.get('memberReplacementId'),
|
294
|
-
'legacyMemberId': associated_ids.get('legacyMemberId'),
|
295
|
-
'customerAccountIdentifier': associated_ids.get('customerAccountIdentifier')
|
296
|
-
})
|
297
|
-
|
298
|
-
# Safely extract plan levels
|
299
|
-
plan_levels = eligibility_info.get('planLevels', [])
|
300
|
-
if plan_levels:
|
301
|
-
rest_response['planLevels'] = plan_levels
|
302
|
-
|
303
|
-
# Safely extract delegated info
|
304
|
-
delegated_info = eligibility_info.get('delegatedInfo', [])
|
305
|
-
if delegated_info:
|
306
|
-
rest_response['delegatedInfo'] = delegated_info
|
307
|
-
|
308
|
-
# Safely extract additional information
|
309
|
-
additional_info = eligibility_info.get('additionalInfo', {})
|
310
|
-
if additional_info:
|
311
|
-
rest_response['isReferralRequired'] = additional_info.get('isReferralRequired')
|
312
|
-
|
313
|
-
# Safely extract primary care physician
|
314
|
-
pcp = first_eligibility.get('primaryCarePhysician', {})
|
315
|
-
if pcp:
|
316
|
-
rest_response.update({
|
317
|
-
'pcpIsFound': pcp.get('isPcpFound'),
|
318
|
-
'pcpLastName': pcp.get('lastName'),
|
319
|
-
'pcpFirstName': pcp.get('firstName'),
|
320
|
-
'pcpMiddleName': pcp.get('middleName'),
|
321
|
-
'pcpPhoneNumber': pcp.get('phoneNumber'),
|
322
|
-
'pcpAddress': pcp.get('address'),
|
323
|
-
'pcpNetworkStatusCode': pcp.get('networkStatusCode'),
|
324
|
-
'pcpAffiliateHospitalName': pcp.get('affiliateHospitalName'),
|
325
|
-
'pcpProviderGroupName': pcp.get('providerGroupName')
|
326
|
-
})
|
327
|
-
|
328
|
-
# Safely extract coordination of benefit
|
329
|
-
cob = first_eligibility.get('coordinationOfBenefit', {})
|
330
|
-
if cob:
|
331
|
-
# Transform COB to handle missing 'id' field in payer
|
332
|
-
transformed_cob = cob.copy()
|
333
|
-
if 'coordinationOfBenefitDetails' in transformed_cob:
|
334
|
-
for detail in transformed_cob['coordinationOfBenefitDetails']:
|
335
|
-
if 'payer' in detail and 'id' not in detail['payer']:
|
336
|
-
# Add empty id field for compatibility
|
337
|
-
detail['payer']['id'] = None
|
338
|
-
rest_response['coordinationOfBenefit'] = transformed_cob
|
339
|
-
|
340
|
-
# Safely extract ID card images
|
341
|
-
id_card_images = first_eligibility.get('idCardImages', [])
|
342
|
-
if id_card_images:
|
343
|
-
rest_response['idCardImages'] = id_card_images
|
344
|
-
|
345
|
-
# Safely extract provider network information
|
346
|
-
provider_network = first_eligibility.get('providerNetwork', {})
|
347
|
-
if provider_network:
|
348
|
-
rest_response.update({
|
349
|
-
'networkStatus': provider_network.get('status'),
|
350
|
-
'networkTier': provider_network.get('tier')
|
351
|
-
})
|
352
|
-
|
353
|
-
# Safely extract service levels
|
354
|
-
service_levels = first_eligibility.get('serviceLevels', [])
|
355
|
-
if service_levels:
|
356
|
-
rest_response['serviceLevels'] = service_levels
|
357
|
-
|
358
|
-
# Extract first service as example for compatibility
|
359
|
-
if service_levels and len(service_levels) > 0:
|
360
|
-
first_service_level = service_levels[0]
|
361
|
-
individual_services = first_service_level.get('individual', [])
|
362
|
-
if individual_services and len(individual_services) > 0:
|
363
|
-
first_individual = individual_services[0]
|
364
|
-
services = first_individual.get('services', [])
|
365
|
-
if services and len(services) > 0:
|
366
|
-
first_service = services[0]
|
367
|
-
rest_response.update({
|
368
|
-
'serviceCode': first_service.get('serviceCode'),
|
369
|
-
'serviceText': first_service.get('text'),
|
370
|
-
'serviceStatus': first_service.get('status'),
|
371
|
-
'coPayAmount': first_service.get('coPayAmount'),
|
372
|
-
'coPayFrequency': first_service.get('coPayFrequency'),
|
373
|
-
'coInsurancePercent': first_service.get('coInsurancePercent'),
|
374
|
-
'planAmount': first_service.get('planAmount'),
|
375
|
-
'remainingAmount': first_service.get('remainingAmount'),
|
376
|
-
'metYearToDateAmount': first_service.get('metYearToDateAmount')
|
377
|
-
})
|
378
|
-
|
379
|
-
# Safely extract extended attributes
|
380
|
-
extended_attrs = first_eligibility.get('extendedAttributes', {})
|
381
|
-
if extended_attrs:
|
382
|
-
rest_response.update({
|
383
|
-
'fundingCode': extended_attrs.get('fundingCode'),
|
384
|
-
'fundingType': extended_attrs.get('fundingType'),
|
385
|
-
'hsa': extended_attrs.get('hsa'),
|
386
|
-
'cdhp': extended_attrs.get('cdhp'),
|
387
|
-
'governmentProgramCode': extended_attrs.get('governmentProgramCode'),
|
388
|
-
'cmsPackageBenefitPlanCode': extended_attrs.get('cmsPackageBenefitPlanCode'),
|
389
|
-
'cmsSegmentId': extended_attrs.get('cmsSegmentId'),
|
390
|
-
'cmsContractId': extended_attrs.get('cmsContractId'),
|
391
|
-
'marketType': extended_attrs.get('marketType'),
|
392
|
-
'obligorId': extended_attrs.get('obligorId'),
|
393
|
-
'marketSite': extended_attrs.get('marketSite'),
|
394
|
-
'benefitPlanId': extended_attrs.get('benefitPlanId'),
|
395
|
-
'virtualVisit': extended_attrs.get('virtualVisit'),
|
396
|
-
'planVariation': extended_attrs.get('planVariation'),
|
397
|
-
'groupNumber': extended_attrs.get('groupNumber'),
|
398
|
-
'legacyPanelNumber': extended_attrs.get('legacyPanelNumber'),
|
399
|
-
'coverageLevel': extended_attrs.get('coverageLevel'),
|
400
|
-
'sharedArrangement': extended_attrs.get('sharedArrangement'),
|
401
|
-
'productServiceCode': extended_attrs.get('productServiceCode'),
|
402
|
-
'designatedVirtualClinicNetwork': extended_attrs.get('designatedVirtualClinicNetwork'),
|
403
|
-
'medicaidVariableCode': extended_attrs.get('medicaidVariableCode'),
|
404
|
-
'healthInsuranceExchangeId': extended_attrs.get('healthInsuranceExchangeId'),
|
405
|
-
'memberDiv': extended_attrs.get('memberDiv'),
|
406
|
-
'legalEntityCode': extended_attrs.get('legalEntityCode')
|
407
|
-
})
|
408
|
-
|
409
|
-
# Safely extract other beneficiaries
|
410
|
-
other_beneficiaries = first_eligibility.get('otherBeneficiaries', [])
|
411
|
-
if other_beneficiaries:
|
412
|
-
rest_response['otherBeneficiaries'] = other_beneficiaries
|
413
|
-
|
414
|
-
return rest_response
|
415
|
-
|
416
|
-
except Exception as e:
|
417
|
-
# Log the error and the response structure for debugging
|
418
|
-
print("Error transforming GraphQL response: {}".format(str(e)))
|
419
|
-
print("Response structure: {}".format(json.dumps(graphql_response, indent=2)))
|
420
|
-
return {
|
421
|
-
'statuscode': '500',
|
422
|
-
'message': 'Error processing GraphQL response: {}'.format(str(e)),
|
423
|
-
'rawGraphQLResponse': graphql_response
|
424
|
-
}
|
425
|
-
|
426
|
-
# Convenience functions for easy access
|
427
|
-
def get_eligibility_query():
|
428
|
-
"""Get the eligibility GraphQL query (working format)"""
|
429
|
-
return GraphQLQueryBuilder.get_eligibility_query()
|
430
|
-
|
431
|
-
def build_eligibility_variables(**kwargs):
|
432
|
-
"""Build eligibility query variables in working format"""
|
433
|
-
return GraphQLQueryBuilder.build_eligibility_variables(**kwargs)
|
434
|
-
|
435
|
-
def build_eligibility_request(variables):
|
436
|
-
"""Build complete eligibility request body with working format"""
|
437
|
-
return GraphQLQueryBuilder.build_eligibility_request(variables)
|
438
|
-
|
439
|
-
def transform_eligibility_response(graphql_response):
|
440
|
-
"""Transform GraphQL eligibility response to REST format"""
|
441
|
-
return GraphQLResponseTransformer.transform_eligibility_response(graphql_response)
|
442
|
-
|
443
|
-
def get_sample_eligibility_request():
|
444
|
-
"""Get the sample GraphQL request from swagger documentation"""
|
445
|
-
return GraphQLQueryBuilder.get_sample_eligibility_request()
|
MediLink/MediLink_StatusCheck.py
DELETED
File without changes
|