medicafe 0.250630.0__py3-none-any.whl → 0.250708.0__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.

Potentially problematic release.


This version of medicafe might be problematic. Click here for more details.

@@ -504,49 +504,72 @@ def get_eligibility_super_connector(client, payer_id, provider_last_name, search
504
504
  if not provider_tin:
505
505
  raise ValueError("Provider TIN not found in configuration")
506
506
 
507
- # Construct GraphQL query variables from the input parameters
508
- # Map the REST API parameters to GraphQL input structure
509
- graphql_variables = {
510
- "memberId": member_id,
511
- "firstName": first_name or "",
512
- "lastName": last_name or provider_last_name, # Use provider_last_name as fallback for lastName
513
- "dateOfBirth": date_of_birth,
514
- "serviceStartDate": service_start or date_of_birth, # Use date_of_birth as fallback
515
- "serviceEndDate": service_end or date_of_birth, # Use date_of_birth as fallback
516
- "coverageTypes": ["Medical"], # Default to Medical coverage
517
- "payerId": payer_id,
518
- "providerLastName": provider_last_name,
519
- "providerFirstName": provider_first_name or "",
520
- "providerNPI": npi
521
- }
507
+ # Construct GraphQL query variables using the consolidated module
508
+ graphql_variables = MediLink_GraphQL.build_eligibility_variables(
509
+ member_id=member_id,
510
+ date_of_birth=date_of_birth,
511
+ payer_id=payer_id,
512
+ provider_last_name=provider_last_name,
513
+ provider_npi=npi
514
+ )
522
515
 
523
- # Remove empty values
524
- graphql_variables = {k: v for k, v in graphql_variables.items() if v}
516
+ # Validate NPI format (should be 10 digits)
517
+ if 'providerNPI' in graphql_variables:
518
+ npi_value = graphql_variables['providerNPI']
519
+ if not npi_value.isdigit() or len(npi_value) != 10:
520
+ MediLink_ConfigLoader.log("Warning: NPI '{}' is not 10 digits, but continuing anyway".format(npi_value), level="WARNING")
525
521
 
526
- # Build GraphQL request using the new module
522
+ # Build GraphQL request using the consolidated module
527
523
  # Hardcoded switch to use sample data for testing
528
- USE_SAMPLE_DATA = True # Set to False to use constructed data
524
+ USE_SAMPLE_DATA = False # Set to False to use constructed data
529
525
 
530
526
  if USE_SAMPLE_DATA:
531
527
  # Use the sample data from swagger documentation
532
528
  graphql_body = MediLink_GraphQL.get_sample_eligibility_request()
533
529
  MediLink_ConfigLoader.log("Using SAMPLE DATA from swagger documentation", level="INFO")
534
530
  else:
535
- # Build GraphQL request with actual data
531
+ # Build GraphQL request with actual data using consolidated module
536
532
  graphql_body = MediLink_GraphQL.build_eligibility_request(graphql_variables)
537
- MediLink_ConfigLoader.log("Using CONSTRUCTED DATA with provided parameters", level="INFO")
533
+ MediLink_ConfigLoader.log("Using CONSTRUCTED DATA with consolidated GraphQL module", level="INFO")
534
+
535
+ # Compare with sample data for debugging
536
+ sample_data = MediLink_GraphQL.get_sample_eligibility_request()
537
+ MediLink_ConfigLoader.log("Sample data structure: {}".format(json.dumps(sample_data, indent=2)), level="DEBUG")
538
+ MediLink_ConfigLoader.log("Constructed data structure: {}".format(json.dumps(graphql_body, indent=2)), level="DEBUG")
539
+
540
+ # Compare key differences
541
+ sample_vars = sample_data['variables']['input']
542
+ constructed_vars = graphql_body['variables']['input']
543
+
544
+ # Log differences in variables
545
+ for key in set(sample_vars.keys()) | set(constructed_vars.keys()):
546
+ sample_val = sample_vars.get(key)
547
+ constructed_val = constructed_vars.get(key)
548
+ if sample_val != constructed_val:
549
+ MediLink_ConfigLoader.log("Variable difference - {}: sample='{}', constructed='{}'".format(
550
+ key, sample_val, constructed_val), level="DEBUG")
538
551
 
539
552
  # Log the GraphQL request
540
553
  MediLink_ConfigLoader.log("GraphQL request body: {}".format(json.dumps(graphql_body, indent=2)), level="DEBUG")
554
+ MediLink_ConfigLoader.log("GraphQL variables: {}".format(json.dumps(graphql_variables, indent=2)), level="DEBUG")
541
555
 
542
556
  # Add required headers for Super Connector
543
557
  headers = {
544
558
  'Content-Type': 'application/json',
545
559
  'Accept': 'application/json',
546
- 'env': 'sandbox',
547
- 'tin': provider_tin
560
+ 'tin': str(provider_tin) # Ensure TIN is a string
548
561
  }
549
562
 
563
+ # Only add env header when using sample data
564
+ if USE_SAMPLE_DATA:
565
+ headers['env'] = 'sandbox'
566
+
567
+ # Remove None values from headers
568
+ headers = {k: v for k, v in headers.items() if v is not None}
569
+
570
+ # Log the final headers being sent
571
+ MediLink_ConfigLoader.log("Final headers being sent: {}".format(json.dumps(headers, indent=2)), level="DEBUG")
572
+
550
573
  # Make the GraphQL API call
551
574
  response = client.make_api_call(endpoint_name, 'POST', url_extension, params=None, data=graphql_body, headers=headers)
552
575
 
@@ -650,7 +673,7 @@ if __name__ == "__main__":
650
673
  'test_claim_summary': False,
651
674
  'test_eligibility': False,
652
675
  'test_eligibility_v3': False,
653
- 'test_eligibility_super_connector': True,
676
+ 'test_eligibility_super_connector': False,
654
677
  'test_claim_submission': False,
655
678
  }
656
679
 
@@ -175,17 +175,29 @@ def manual_deductible_lookup():
175
175
  def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, member_id, npi):
176
176
  try:
177
177
  # Log the parameters being sent to the function
178
- MediLink_ConfigLoader.log("Calling get_eligibility_v3 with parameters:", level="DEBUG")
178
+ MediLink_ConfigLoader.log("Calling eligibility check with parameters:", level="DEBUG")
179
179
  MediLink_ConfigLoader.log("payer_id: {}".format(payer_id), level="DEBUG")
180
180
  MediLink_ConfigLoader.log("provider_last_name: {}".format(provider_last_name), level="DEBUG")
181
181
  MediLink_ConfigLoader.log("date_of_birth: {}".format(date_of_birth), level="DEBUG")
182
182
  MediLink_ConfigLoader.log("member_id: {}".format(member_id), level="DEBUG")
183
183
  MediLink_ConfigLoader.log("npi: {}".format(npi), level="DEBUG")
184
184
 
185
- # Call the get_eligibility_v3 function
186
- eligibility = MediLink_API_v3.get_eligibility_v3(
187
- client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
188
- )
185
+ # Configuration flag to control which API to use
186
+ # Set to False to use the new Super Connector API, True to use the legacy v3 API
187
+ USE_LEGACY_API = False
188
+
189
+ if USE_LEGACY_API:
190
+ # Use the legacy get_eligibility_v3 function as primary
191
+ MediLink_ConfigLoader.log("Using legacy get_eligibility_v3 API", level="INFO")
192
+ eligibility = MediLink_API_v3.get_eligibility_v3(
193
+ client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
194
+ )
195
+ else:
196
+ # Use the new Super Connector API as primary
197
+ MediLink_ConfigLoader.log("Using new get_eligibility_super_connector API", level="INFO")
198
+ eligibility = MediLink_API_v3.get_eligibility_super_connector(
199
+ client, payer_id, provider_last_name, 'MemberIDDateOfBirth', date_of_birth, member_id, npi
200
+ )
189
201
 
190
202
  # Log the response
191
203
  MediLink_ConfigLoader.log("Eligibility response: {}".format(json.dumps(eligibility, indent=4)), level="DEBUG")
@@ -5,7 +5,6 @@ Handles query templates, query building, and response transformations
5
5
  """
6
6
 
7
7
  import json
8
- from typing import Dict, Any, Optional, List
9
8
 
10
9
  class GraphQLQueryBuilder:
11
10
  """Builder class for constructing GraphQL queries for Super Connector API"""
@@ -14,702 +13,86 @@ class GraphQLQueryBuilder:
14
13
  def get_eligibility_query() -> str:
15
14
  """
16
15
  Returns the GraphQL query for eligibility checks.
17
- Based on the Super Connector swagger documentation.
18
- """
19
- return """
20
- query CheckEligibility($input: EligibilityInput!) {
21
- checkEligibility(input: $input) {
22
- eligibility {
23
- eligibilityInfo {
24
- trnId
25
- member {
26
- memberId
27
- firstName
28
- lastName
29
- middleName
30
- suffix
31
- dateOfBirth
32
- gender
33
- relationship
34
- relationshipCode
35
- relationshipTypeCode
36
- individualRelationshipCode
37
- dependentSequenceNumber
38
- }
39
- contact {
40
- addresses {
41
- type
42
- street1
43
- street2
44
- city
45
- state
46
- country
47
- zip
48
- zip4
49
- }
50
- }
51
- insuranceInfo {
52
- policyNumber
53
- eligibilityStartDate
54
- eligibilityEndDate
55
- planStartDate
56
- planEndDate
57
- policyStatus
58
- planTypeDescription
59
- planVariation
60
- reportingCode
61
- stateOfIssueCode
62
- productType
63
- productId
64
- productCode
65
- payerId
66
- lineOfBusiness
67
- lineOfBusinessCode
68
- coverageTypes {
69
- typeCode
70
- description
71
- }
72
- }
73
- associatedIds {
74
- alternateId
75
- medicaidRecipientId
76
- exchangeMemberId
77
- alternateSubscriberId
78
- hicNumber
79
- mbiNumber
80
- subscriberMemberFacingIdentifier
81
- survivingSpouseId
82
- subscriberId
83
- memberReplacementId
84
- legacyMemberId
85
- customerAccountIdentifier
86
- }
87
- planLevels {
88
- level
89
- family {
90
- networkStatus
91
- planAmount
92
- planAmountFrequency
93
- remainingAmount
94
- }
95
- individual {
96
- networkStatus
97
- planAmount
98
- planAmountFrequency
99
- remainingAmount
100
- }
101
- }
102
- delegatedInfo {
103
- entity
104
- payerId
105
- contact {
106
- phone
107
- fax
108
- email
109
- }
110
- addresses {
111
- type
112
- street1
113
- street2
114
- city
115
- state
116
- country
117
- zip
118
- zip4
119
- }
120
- }
121
- additionalInfo {
122
- isReferralRequired
123
- }
124
- }
125
- primaryCarePhysician {
126
- isPcpFound
127
- lastName
128
- firstName
129
- middleName
130
- phoneNumber
131
- address {
132
- type
133
- street1
134
- street2
135
- city
136
- state
137
- country
138
- zip
139
- zip4
140
- }
141
- networkStatusCode
142
- affiliateHospitalName
143
- providerGroupName
144
- }
145
- coordinationOfBenefit {
146
- coordinationOfBenefitDetails {
147
- payer {
148
- id
149
- name
150
- phoneNumber
151
- address {
152
- type
153
- street1
154
- street2
155
- city
156
- state
157
- country
158
- zip
159
- zip4
160
- }
161
- }
162
- cobPrimacy {
163
- indicator
164
- description
165
- message
166
- }
167
- }
168
- uhgPrimacyStatus {
169
- policyEffectiveDate
170
- policyTerminationDate
171
- primacy {
172
- indicator
173
- description
174
- message
175
- }
176
- }
177
- }
178
- idCardImages {
179
- side
180
- content
181
- contentType
182
- }
183
- providerNetwork {
184
- status
185
- tier
186
- }
187
- serviceLevels {
188
- family {
189
- networkStatus
190
- services {
191
- isVendorOnly
192
- service
193
- serviceCode
194
- serviceDate
195
- text
196
- status
197
- coPayAmount
198
- coPayFrequency
199
- coInsurancePercent
200
- planAmount
201
- remainingAmount
202
- metYearToDateAmount
203
- isReferralObtainedCopay
204
- isReferralObtainedCoInsurance
205
- referralCopayAmount
206
- referralCoInsurancePercent
207
- benefitsAllowedFrequencies
208
- benefitsRemainingFrequencies
209
- message {
210
- note {
211
- isSingleMessageDetail
212
- isViewDetail
213
- messages
214
- text
215
- subMessages {
216
- service
217
- status
218
- copay
219
- msg
220
- startDate
221
- endDate
222
- minCopay
223
- minCopayMsg
224
- maxCopay
225
- maxCopayMsg
226
- isPrimaryIndicator
227
- }
228
- limitationInfo {
229
- lmtPeriod
230
- lmtType
231
- lmtOccurPerPeriod
232
- lmtDollarPerPeriod
233
- message
234
- }
235
- isMultipleCopaysFound
236
- isMultipleCoinsuranceFound
237
- }
238
- coPay {
239
- isSingleMessageDetail
240
- isViewDetail
241
- messages
242
- text
243
- subMessages {
244
- service
245
- status
246
- copay
247
- msg
248
- startDate
249
- endDate
250
- minCopay
251
- minCopayMsg
252
- maxCopay
253
- maxCopayMsg
254
- isPrimaryIndicator
255
- }
256
- limitationInfo {
257
- lmtPeriod
258
- lmtType
259
- lmtOccurPerPeriod
260
- lmtDollarPerPeriod
261
- message
262
- }
263
- isMultipleCopaysFound
264
- isMultipleCoinsuranceFound
265
- }
266
- coInsurance {
267
- isSingleMessageDetail
268
- isViewDetail
269
- messages
270
- text
271
- subMessages {
272
- service
273
- status
274
- copay
275
- msg
276
- startDate
277
- endDate
278
- minCopay
279
- minCopayMsg
280
- maxCopay
281
- maxCopayMsg
282
- isPrimaryIndicator
283
- }
284
- limitationInfo {
285
- lmtPeriod
286
- lmtType
287
- lmtOccurPerPeriod
288
- lmtDollarPerPeriod
289
- message
290
- }
291
- isMultipleCopaysFound
292
- isMultipleCoinsuranceFound
293
- }
294
- deductible {
295
- isSingleMessageDetail
296
- isViewDetail
297
- messages
298
- text
299
- subMessages {
300
- service
301
- status
302
- copay
303
- msg
304
- startDate
305
- endDate
306
- minCopay
307
- minCopayMsg
308
- maxCopay
309
- maxCopayMsg
310
- isPrimaryIndicator
311
- }
312
- limitationInfo {
313
- lmtPeriod
314
- lmtType
315
- lmtOccurPerPeriod
316
- lmtDollarPerPeriod
317
- message
318
- }
319
- isMultipleCopaysFound
320
- isMultipleCoinsuranceFound
321
- }
322
- benefitsAllowed {
323
- isSingleMessageDetail
324
- isViewDetail
325
- messages
326
- text
327
- subMessages {
328
- service
329
- status
330
- copay
331
- msg
332
- startDate
333
- endDate
334
- minCopay
335
- minCopayMsg
336
- maxCopay
337
- maxCopayMsg
338
- isPrimaryIndicator
339
- }
340
- limitationInfo {
341
- lmtPeriod
342
- lmtType
343
- lmtOccurPerPeriod
344
- lmtDollarPerPeriod
345
- message
346
- }
347
- isMultipleCopaysFound
348
- isMultipleCoinsuranceFound
349
- }
350
- benefitsRemaining {
351
- isSingleMessageDetail
352
- isViewDetail
353
- messages
354
- text
355
- subMessages {
356
- service
357
- status
358
- copay
359
- msg
360
- startDate
361
- endDate
362
- minCopay
363
- minCopayMsg
364
- maxCopay
365
- maxCopayMsg
366
- isPrimaryIndicator
367
- }
368
- limitationInfo {
369
- lmtPeriod
370
- lmtType
371
- lmtOccurPerPeriod
372
- lmtDollarPerPeriod
373
- message
374
- }
375
- isMultipleCopaysFound
376
- isMultipleCoinsuranceFound
377
- }
378
- coPayList
379
- coInsuranceList
380
- }
381
- }
382
- }
383
- individual {
384
- networkStatus
385
- services {
386
- isVendorOnly
387
- service
388
- serviceCode
389
- serviceDate
390
- text
391
- status
392
- coPayAmount
393
- coPayFrequency
394
- coInsurancePercent
395
- planAmount
396
- remainingAmount
397
- metYearToDateAmount
398
- isReferralObtainedCopay
399
- isReferralObtainedCoInsurance
400
- referralCopayAmount
401
- referralCoInsurancePercent
402
- benefitsAllowedFrequencies
403
- benefitsRemainingFrequencies
404
- message {
405
- note {
406
- isSingleMessageDetail
407
- isViewDetail
408
- messages
409
- text
410
- subMessages {
411
- service
412
- status
413
- copay
414
- msg
415
- startDate
416
- endDate
417
- minCopay
418
- minCopayMsg
419
- maxCopay
420
- maxCopayMsg
421
- isPrimaryIndicator
422
- }
423
- limitationInfo {
424
- lmtPeriod
425
- lmtType
426
- lmtOccurPerPeriod
427
- lmtDollarPerPeriod
428
- message
429
- }
430
- isMultipleCopaysFound
431
- isMultipleCoinsuranceFound
432
- }
433
- coPay {
434
- isSingleMessageDetail
435
- isViewDetail
436
- messages
437
- text
438
- subMessages {
439
- service
440
- status
441
- copay
442
- msg
443
- startDate
444
- endDate
445
- minCopay
446
- minCopayMsg
447
- maxCopay
448
- maxCopayMsg
449
- isPrimaryIndicator
450
- }
451
- limitationInfo {
452
- lmtPeriod
453
- lmtType
454
- lmtOccurPerPeriod
455
- lmtDollarPerPeriod
456
- message
457
- }
458
- isMultipleCopaysFound
459
- isMultipleCoinsuranceFound
460
- }
461
- coInsurance {
462
- isSingleMessageDetail
463
- isViewDetail
464
- messages
465
- text
466
- subMessages {
467
- service
468
- status
469
- copay
470
- msg
471
- startDate
472
- endDate
473
- minCopay
474
- minCopayMsg
475
- maxCopay
476
- maxCopayMsg
477
- isPrimaryIndicator
478
- }
479
- limitationInfo {
480
- lmtPeriod
481
- lmtType
482
- lmtOccurPerPeriod
483
- lmtDollarPerPeriod
484
- message
485
- }
486
- isMultipleCopaysFound
487
- isMultipleCoinsuranceFound
488
- }
489
- deductible {
490
- isSingleMessageDetail
491
- isViewDetail
492
- messages
493
- text
494
- subMessages {
495
- service
496
- status
497
- copay
498
- msg
499
- startDate
500
- endDate
501
- minCopay
502
- minCopayMsg
503
- maxCopay
504
- maxCopayMsg
505
- isPrimaryIndicator
506
- }
507
- limitationInfo {
508
- lmtPeriod
509
- lmtType
510
- lmtOccurPerPeriod
511
- lmtDollarPerPeriod
512
- message
513
- }
514
- isMultipleCopaysFound
515
- isMultipleCoinsuranceFound
516
- }
517
- benefitsAllowed {
518
- isSingleMessageDetail
519
- isViewDetail
520
- messages
521
- text
522
- subMessages {
523
- service
524
- status
525
- copay
526
- msg
527
- startDate
528
- endDate
529
- minCopay
530
- minCopayMsg
531
- maxCopay
532
- maxCopayMsg
533
- isPrimaryIndicator
534
- }
535
- limitationInfo {
536
- lmtPeriod
537
- lmtType
538
- lmtOccurPerPeriod
539
- lmtDollarPerPeriod
540
- message
541
- }
542
- isMultipleCopaysFound
543
- isMultipleCoinsuranceFound
544
- }
545
- benefitsRemaining {
546
- isSingleMessageDetail
547
- isViewDetail
548
- messages
549
- text
550
- subMessages {
551
- service
552
- status
553
- copay
554
- msg
555
- startDate
556
- endDate
557
- minCopay
558
- minCopayMsg
559
- maxCopay
560
- maxCopayMsg
561
- isPrimaryIndicator
562
- }
563
- limitationInfo {
564
- lmtPeriod
565
- lmtType
566
- lmtOccurPerPeriod
567
- lmtDollarPerPeriod
568
- message
569
- }
570
- isMultipleCopaysFound
571
- isMultipleCoinsuranceFound
572
- }
573
- coPayList
574
- coInsuranceList
575
- }
576
- }
577
- }
578
- }
579
- extendedAttributes {
580
- fundingCode
581
- fundingType
582
- hsa
583
- cdhp
584
- governmentProgramCode
585
- cmsPackageBenefitPlanCode
586
- cmsSegmentId
587
- cmsContractId
588
- marketType
589
- obligorId
590
- marketSite
591
- benefitPlanId
592
- virtualVisit
593
- planVariation
594
- groupNumber
595
- legacyPanelNumber
596
- coverageLevel
597
- sharedArrangement
598
- productServiceCode
599
- designatedVirtualClinicNetwork
600
- medicaidVariableCode
601
- healthInsuranceExchangeId
602
- memberDiv
603
- legalEntityCode
604
- }
605
- otherBeneficiaries {
606
- memberId
607
- firstName
608
- lastName
609
- middleName
610
- suffix
611
- dateOfBirth
612
- gender
613
- relationship
614
- relationshipCode
615
- relationshipTypeCode
616
- individualRelationshipCode
617
- dependentSequenceNumber
618
- }
619
- }
620
- }
621
- }
16
+ Uses the exact working format from the successful cURL request.
622
17
  """
18
+ return GraphQLQueryBuilder.get_working_eligibility_query()
623
19
 
624
20
  @staticmethod
625
21
  def build_eligibility_variables(
626
- member_id: str,
627
- first_name: Optional[str] = None,
628
- last_name: Optional[str] = None,
629
- date_of_birth: Optional[str] = None,
630
- service_start_date: Optional[str] = None,
631
- service_end_date: Optional[str] = None,
632
- coverage_types: Optional[List[str]] = None,
633
- payer_id: Optional[str] = None,
634
- provider_last_name: Optional[str] = None,
635
- provider_first_name: Optional[str] = None,
636
- provider_npi: Optional[str] = None,
637
- group_number: Optional[str] = None,
638
- trn_id: Optional[str] = None,
639
- service_level_codes: Optional[List[str]] = None,
640
- plan_start_date: Optional[str] = None,
641
- plan_end_date: Optional[str] = None,
642
- family_indicator: Optional[str] = None
643
- ) -> Dict[str, Any]:
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
+ ):
644
40
  """
645
41
  Builds the variables object for the eligibility GraphQL query.
42
+ Uses the exact format that works with the Super Connector API.
646
43
 
647
44
  Args:
648
45
  member_id: Unique identifier for the member
649
- first_name: First name of the member
650
- last_name: Last name of 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)
651
48
  date_of_birth: Date of birth in ISO 8601 format (YYYY-MM-DD)
652
- service_start_date: Start date of the service in ISO 8601 format
653
- service_end_date: End date of the service in ISO 8601 format
654
- coverage_types: Types of coverage to include (e.g., ["Medical", "Behavioral"])
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)
655
52
  payer_id: Payer identifier
656
53
  provider_last_name: Last name of the provider
657
- provider_first_name: First name of the provider
54
+ provider_first_name: First name of the provider (not used in working format)
658
55
  provider_npi: National Provider Identifier (NPI) of the provider
659
- group_number: Group number
660
- trn_id: Transaction identifier
661
- service_level_codes: Service level codes (max 10)
662
- plan_start_date: Start date of the plan in ISO 8601 format
663
- plan_end_date: End date of the plan in ISO 8601 format
664
- family_indicator: Indicator for family/individual
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)
665
62
 
666
63
  Returns:
667
- Dictionary containing the variables for the GraphQL query
64
+ Dictionary containing the variables for the GraphQL query in working format
668
65
  """
66
+ # Build variables in the exact format that works with the API
669
67
  variables = {
670
- "memberId": member_id
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": ""
671
84
  }
672
85
 
673
- # Add optional parameters if provided
674
- if first_name:
675
- variables["firstName"] = first_name
676
- if last_name:
677
- variables["lastName"] = last_name
678
- if date_of_birth:
679
- variables["dateOfBirth"] = date_of_birth
680
- if service_start_date:
681
- variables["serviceStartDate"] = service_start_date
682
- if service_end_date:
683
- variables["serviceEndDate"] = service_end_date
684
- if coverage_types:
685
- variables["coverageTypes"] = coverage_types
686
- if payer_id:
687
- variables["payerId"] = payer_id
688
- if provider_last_name:
689
- variables["providerLastName"] = provider_last_name
690
- if provider_first_name:
691
- variables["providerFirstName"] = provider_first_name
692
- if provider_npi:
693
- variables["providerNPI"] = provider_npi
694
- if group_number:
695
- variables["groupNumber"] = group_number
696
- if trn_id:
697
- variables["trnId"] = trn_id
698
- if service_level_codes:
699
- variables["serviceLevelCodes"] = service_level_codes
700
- if plan_start_date:
701
- variables["planStartDate"] = plan_start_date
702
- if plan_end_date:
703
- variables["planEndDate"] = plan_end_date
704
- if family_indicator:
705
- variables["familyIndicator"] = family_indicator
706
-
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
+
707
89
  return variables
708
90
 
709
91
  @staticmethod
710
- def build_eligibility_request(variables: Dict[str, Any]) -> Dict[str, Any]:
92
+ def build_eligibility_request(variables):
711
93
  """
712
94
  Builds the complete GraphQL request body for eligibility checks.
95
+ Uses the working query format.
713
96
 
714
97
  Args:
715
98
  variables: Variables dictionary for the GraphQL query
@@ -717,21 +100,16 @@ class GraphQLQueryBuilder:
717
100
  Returns:
718
101
  Complete GraphQL request body
719
102
  """
720
- return {
721
- "query": GraphQLQueryBuilder.get_eligibility_query(),
722
- "variables": {
723
- "input": variables
724
- }
725
- }
103
+ return GraphQLQueryBuilder.build_working_eligibility_request(variables)
726
104
 
727
105
  @staticmethod
728
- def get_sample_eligibility_request() -> Dict[str, Any]:
106
+ def get_sample_eligibility_request():
729
107
  """
730
108
  Returns the sample GraphQL request from the swagger documentation.
731
109
  This is for testing purposes to verify the endpoint is working.
732
110
  """
733
111
  return {
734
- "query": "query CheckEligibility($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 { id 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 } 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 } } } } 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 } } } }",
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 } } } } } } }",
735
113
  "variables": {
736
114
  "input": {
737
115
  "memberId": "0001234567",
@@ -746,16 +124,48 @@ class GraphQLQueryBuilder:
746
124
  "payerId": "12345",
747
125
  "providerLastName": "XYZ",
748
126
  "providerFirstName": "QWERT",
749
- "providerNPI": "1234567890"
127
+ "providerNPI": "1234567890",
128
+ "groupNumber": "",
129
+ "serviceLevelCodes": [],
130
+ "planStartDate": "",
131
+ "planEndDate": "",
132
+ "familyIndicator": "",
133
+ "trnId": ""
750
134
  }
751
135
  }
752
136
  }
753
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 idCardImages {\r\n side\r\n content\r\n contentType\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
+
754
164
  class GraphQLResponseTransformer:
755
165
  """Transforms GraphQL responses to match REST API format"""
756
166
 
757
167
  @staticmethod
758
- def transform_eligibility_response(graphql_response: Dict[str, Any]) -> Dict[str, Any]:
168
+ def transform_eligibility_response(graphql_response):
759
169
  """
760
170
  Transforms the GraphQL eligibility response to match the REST API format.
761
171
  This ensures the calling code receives the same structure regardless of endpoint.
@@ -882,7 +292,14 @@ class GraphQLResponseTransformer:
882
292
  # Safely extract coordination of benefit
883
293
  cob = first_eligibility.get('coordinationOfBenefit', {})
884
294
  if cob:
885
- rest_response['coordinationOfBenefit'] = cob
295
+ # Transform COB to handle missing 'id' field in payer
296
+ transformed_cob = cob.copy()
297
+ if 'coordinationOfBenefitDetails' in transformed_cob:
298
+ for detail in transformed_cob['coordinationOfBenefitDetails']:
299
+ if 'payer' in detail and 'id' not in detail['payer']:
300
+ # Add empty id field for compatibility
301
+ detail['payer']['id'] = None
302
+ rest_response['coordinationOfBenefit'] = transformed_cob
886
303
 
887
304
  # Safely extract ID card images
888
305
  id_card_images = first_eligibility.get('idCardImages', [])
@@ -971,22 +388,22 @@ class GraphQLResponseTransformer:
971
388
  }
972
389
 
973
390
  # Convenience functions for easy access
974
- def get_eligibility_query() -> str:
975
- """Get the eligibility GraphQL query"""
391
+ def get_eligibility_query():
392
+ """Get the eligibility GraphQL query (working format)"""
976
393
  return GraphQLQueryBuilder.get_eligibility_query()
977
394
 
978
- def build_eligibility_variables(**kwargs) -> Dict[str, Any]:
979
- """Build eligibility query variables"""
395
+ def build_eligibility_variables(**kwargs):
396
+ """Build eligibility query variables in working format"""
980
397
  return GraphQLQueryBuilder.build_eligibility_variables(**kwargs)
981
398
 
982
- def build_eligibility_request(variables: Dict[str, Any]) -> Dict[str, Any]:
983
- """Build complete eligibility request body"""
399
+ def build_eligibility_request(variables):
400
+ """Build complete eligibility request body with working format"""
984
401
  return GraphQLQueryBuilder.build_eligibility_request(variables)
985
402
 
986
- def transform_eligibility_response(graphql_response: Dict[str, Any]) -> Dict[str, Any]:
403
+ def transform_eligibility_response(graphql_response):
987
404
  """Transform GraphQL eligibility response to REST format"""
988
405
  return GraphQLResponseTransformer.transform_eligibility_response(graphql_response)
989
406
 
990
- def get_sample_eligibility_request() -> Dict[str, Any]:
407
+ def get_sample_eligibility_request():
991
408
  """Get the sample GraphQL request from swagger documentation"""
992
409
  return GraphQLQueryBuilder.get_sample_eligibility_request()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250630.0
3
+ Version: 0.250708.0
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -19,18 +19,18 @@ MediLink/MediLink_837p_encoder.py,sha256=id2qhKUYq_raKcDr5pAY1xF0V_UR5KBC8SXDAeh
19
19
  MediLink/MediLink_837p_encoder_library.py,sha256=rxame7v_LcNJe8Wdt3INQkTC5MdIbZq9ySsR90OL6Lo,49924
20
20
  MediLink/MediLink_API_Generator.py,sha256=vBZ8moR9tvv7mb200HlZnJrk1y-bQi8E16I2r41vgVM,10345
21
21
  MediLink/MediLink_API_v2.py,sha256=mcIgLnXPS_NaUBrkKJ8mxCUaQ0AuQUeU1vG6DoplbVY,7733
22
- MediLink/MediLink_API_v3.py,sha256=5eBB50zvKlDl815koxnh7zrz8JX3JuJGFSG1IIcRC08,38292
22
+ MediLink/MediLink_API_v3.py,sha256=_M-rspeOVoetEXA1omJfxmYgjZWhNR6KOsJu8yV0otY,39617
23
23
  MediLink/MediLink_APIs.py,sha256=jm3f9T034MJKH8A_CIootULoeuk7H8s7PazpFZRCbKI,6222
24
24
  MediLink/MediLink_Azure.py,sha256=Ow70jctiHFIylskBExN7WUoRgrKOvBR6jNTnQMk6lJA,210
25
25
  MediLink/MediLink_ClaimStatus.py,sha256=GNZ9mRrjxemBHJ5LiJb2DUWhKgWX2vTNY5jxoUgqv-I,9776
26
26
  MediLink/MediLink_ConfigLoader.py,sha256=u9ecB0SIN7zuJAo8KcoQys95BtyAo-8S2n4mRd0S3XU,4356
27
27
  MediLink/MediLink_DataMgmt.py,sha256=jrTAPSNVzs1wwYl1g0_8Mda3k2B27CbaSw8Pu2qmThw,33058
28
28
  MediLink/MediLink_Decoder.py,sha256=Suw9CmUHgoe0ZW8sJP_pIO8URBrhO5FmxFF8RcUj9lI,13318
29
- MediLink/MediLink_Deductible.py,sha256=G1l7shl6uvMBO4R14CcKJ41lRW2AiR9Ahg1tHsETZzo,13490
29
+ MediLink/MediLink_Deductible.py,sha256=qZR-d_9Nb1CzbYTXj95PBqS9I-l6kfSKzGfHL8lL38c,14206
30
30
  MediLink/MediLink_Down.py,sha256=hrDODhs-zRfOKCdiRGENN5Czu-AvdtwJj4Q7grcRXME,6518
31
31
  MediLink/MediLink_ERA_decoder.py,sha256=MiOtDcXnmevPfHAahIlTLlUc14VcQWAor9Xa7clA2Ts,8710
32
32
  MediLink/MediLink_Gmail.py,sha256=OYsASNgP4YSTaSnj9XZxPPiy0cw41JC-suLIgRyNrlQ,31439
33
- MediLink/MediLink_GraphQL.py,sha256=O_sXtRBGJVPJYRSc6kvPGaVNMQOIV7Hvf0NECgYSlK4,55117
33
+ MediLink/MediLink_GraphQL.py,sha256=Ikst5REpvJCbKf0AvY0k6oNGR4nG_FuQuwXgYDbh6-U,44095
34
34
  MediLink/MediLink_Mailer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  MediLink/MediLink_Parser.py,sha256=YCg2jvoJUi048GICUmP0v71b-hGqwxUQelhoi3P33i4,8128
36
36
  MediLink/MediLink_Scan.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -44,8 +44,8 @@ MediLink/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  MediLink/openssl.cnf,sha256=76VdcGCykf0Typyiv8Wd1mMVKixrQ5RraG6HnfKFqTo,887
45
45
  MediLink/test.py,sha256=kSvvJRL_3fWuNS3_x4hToOnUljGLoeEw6SUTHQWQRJk,3108
46
46
  MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
47
- medicafe-0.250630.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
48
- medicafe-0.250630.0.dist-info/METADATA,sha256=G-LZjUXxvelD_VlrPCCQb6ZxhX6JCkWEId9abiWm2GE,5501
49
- medicafe-0.250630.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
50
- medicafe-0.250630.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
51
- medicafe-0.250630.0.dist-info/RECORD,,
47
+ medicafe-0.250708.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
48
+ medicafe-0.250708.0.dist-info/METADATA,sha256=t3MOA51V-8NM6P7GI2DO1LgYb92Iw_YHbPp2QM--FD4,5501
49
+ medicafe-0.250708.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
50
+ medicafe-0.250708.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
51
+ medicafe-0.250708.0.dist-info/RECORD,,