medicafe 0.240613.0__py3-none-any.whl → 0.240809.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.

@@ -1,29 +1,30 @@
1
1
  # MediLink_Parser.py
2
+
2
3
  def parse_era_content(content):
3
4
  extracted_data = []
4
5
  normalized_content = content.replace('~\n', '~')
5
6
  lines = normalized_content.split('~')
6
-
7
+
7
8
  record = {}
8
9
  check_eft, payer_address = None, None
9
10
  allowed_amount, write_off, patient_responsibility, adjustment_amount = 0, 0, 0, 0
10
11
  is_payer_section = False
11
-
12
+
12
13
  for line in lines:
13
14
  segments = line.split('*')
14
-
15
+
15
16
  if segments[0] == 'TRN' and len(segments) > 2:
16
17
  check_eft = segments[2]
17
-
18
+
18
19
  if segments[0] == 'N1':
19
20
  if segments[1] == 'PR':
20
21
  is_payer_section = True
21
22
  elif segments[1] == 'PE':
22
23
  is_payer_section = False
23
-
24
+
24
25
  if is_payer_section and segments[0] == 'N3' and len(segments) > 1:
25
26
  payer_address = segments[1]
26
-
27
+
27
28
  if segments[0] == 'CLP' and len(segments) >= 5:
28
29
  if record:
29
30
  if adjustment_amount == 0 and (write_off > 0 or patient_responsibility > 0):
@@ -34,12 +35,12 @@ def parse_era_content(content):
34
35
  'Allowed Amount': allowed_amount,
35
36
  'Write Off': write_off,
36
37
  'Patient Responsibility': patient_responsibility,
37
- 'Adjustment Amount': adjustment_amount,
38
+ 'Adjustment Amount': adjustment_amount,
38
39
  })
39
40
  extracted_data.append(record)
40
-
41
+
41
42
  allowed_amount, write_off, patient_responsibility, adjustment_amount = 0, 0, 0, 0
42
-
43
+
43
44
  record = {
44
45
  'Check EFT': check_eft,
45
46
  'Chart Number': segments[1],
@@ -47,7 +48,7 @@ def parse_era_content(content):
47
48
  'Amount Paid': segments[4],
48
49
  'Charge': segments[3],
49
50
  }
50
-
51
+
51
52
  elif segments[0] == 'CAS':
52
53
  if segments[1] == 'CO':
53
54
  write_off += float(segments[3])
@@ -55,13 +56,13 @@ def parse_era_content(content):
55
56
  patient_responsibility += float(segments[3])
56
57
  elif segments[1] == 'OA':
57
58
  adjustment_amount += float(segments[3])
58
-
59
+
59
60
  elif segments[0] == 'AMT' and segments[1] == 'B6':
60
61
  allowed_amount += float(segments[2])
61
-
62
+
62
63
  elif segments[0] == 'DTM' and (segments[1] == '232' or segments[1] == '472'):
63
64
  record['Date of Service'] = segments[2]
64
-
65
+
65
66
  if record:
66
67
  if adjustment_amount == 0 and (write_off > 0 or patient_responsibility > 0):
67
68
  adjustment_amount = write_off + patient_responsibility
@@ -69,10 +70,14 @@ def parse_era_content(content):
69
70
  'Allowed Amount': allowed_amount,
70
71
  'Write Off': write_off,
71
72
  'Patient Responsibility': patient_responsibility,
72
- 'Adjustment Amount': adjustment_amount,
73
+ 'Adjustment Amount': adjustment_amount,
73
74
  })
74
75
  extracted_data.append(record)
75
-
76
+
77
+ print("Parsed ERA Content:")
78
+ for data in extracted_data:
79
+ print(data)
80
+
76
81
  return extracted_data
77
82
 
78
83
  def parse_277_content(content):
@@ -87,25 +92,102 @@ def parse_277_content(content):
87
92
  current_record = {}
88
93
  elif parts[0] == 'NM1':
89
94
  if parts[1] == 'QC':
90
- current_record['Last'] = parts[3]
91
- current_record['First'] = parts[4]
95
+ current_record['Patient'] = parts[3] + ' ' + parts[4]
92
96
  elif parts[1] == '41':
93
97
  current_record['Clearing House'] = parts[3]
98
+ elif parts[1] == 'PR':
99
+ current_record['Payer'] = parts[3]
94
100
  elif parts[0] == 'TRN':
95
- current_record['Claim Status Tracking #'] = parts[2]
101
+ current_record['Claim #'] = parts[2]
96
102
  elif parts[0] == 'STC':
97
103
  current_record['Status'] = parts[1]
98
- current_record['Acknowledged Amt'] = parts[4]
104
+ if len(parts) > 4:
105
+ current_record['Paid'] = parts[4]
99
106
  elif parts[0] == 'DTP':
100
107
  if parts[1] == '472':
101
- current_record['Date of Service'] = parts[3]
108
+ current_record['Serv.'] = parts[3]
102
109
  elif parts[1] == '050':
103
- current_record['Received Date'] = parts[3]
110
+ current_record['Proc.'] = parts[3]
104
111
  elif parts[0] == 'AMT':
105
112
  if parts[1] == 'YU':
106
- current_record['Billed Amt'] = parts[2]
107
-
113
+ current_record['Charged'] = parts[2]
114
+
108
115
  if current_record:
109
116
  records.append(current_record)
110
-
117
+
118
+ print("Parsed 277 Content:")
119
+ for record in records:
120
+ print(record)
121
+
111
122
  return records
123
+
124
+ def parse_277IBR_content(content):
125
+ return parse_277_content(content)
126
+
127
+ def parse_277EBR_content(content):
128
+ return parse_277_content(content)
129
+
130
+ def parse_dpt_content(content):
131
+ extracted_data = []
132
+ lines = content.splitlines()
133
+ record = {}
134
+ for line in lines:
135
+ if 'Patient Account Number:' in line:
136
+ if record:
137
+ extracted_data.append(record)
138
+ record = {}
139
+ parts = line.split(':')
140
+ if len(parts) == 2:
141
+ key, value = parts[0].strip(), parts[1].strip()
142
+ record[key] = value
143
+ if record:
144
+ extracted_data.append(record)
145
+
146
+ print("Parsed DPT Content:")
147
+ for data in extracted_data:
148
+ print(data)
149
+
150
+ return extracted_data
151
+
152
+ def parse_ebt_content(content):
153
+ extracted_data = []
154
+ lines = content.splitlines()
155
+ record = {}
156
+ for line in lines:
157
+ if 'Patient Name:' in line and record:
158
+ extracted_data.append(record)
159
+ record = {}
160
+ parts = line.split(':')
161
+ if len(parts) == 2:
162
+ key, value = parts[0].strip(), parts[1].strip()
163
+ record[key] = value
164
+ if record:
165
+ extracted_data.append(record)
166
+
167
+ print("Parsed EBT Content:")
168
+ for data in extracted_data:
169
+ print(data)
170
+
171
+ return extracted_data
172
+
173
+ def parse_ibt_content(content):
174
+ extracted_data = []
175
+ lines = content.splitlines()
176
+ record = {}
177
+ for line in lines:
178
+ if 'Submitter Batch ID:' in line:
179
+ if record:
180
+ extracted_data.append(record)
181
+ record = {}
182
+ parts = line.split(':')
183
+ if len(parts) == 2:
184
+ key, value = parts[0].strip(), parts[1].strip()
185
+ record[key] = value
186
+ if record:
187
+ extracted_data.append(record)
188
+
189
+ print("Parsed IBT Content:")
190
+ for data in extracted_data:
191
+ print(data)
192
+
193
+ return extracted_data
MediLink/MediLink_UI.py CHANGED
@@ -1,5 +1,14 @@
1
1
  from datetime import datetime
2
2
  import os
3
+ import sys
4
+
5
+ project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
6
+ sys.path.append(project_dir)
7
+
8
+ try:
9
+ import MediLink_ConfigLoader
10
+ except ImportError:
11
+ from MediLink import MediLink_ConfigLoader
3
12
 
4
13
  def display_welcome():
5
14
  print("\n" + "-" * 60)
@@ -76,32 +85,9 @@ def get_new_endpoint_choice():
76
85
  # Function to display full list of insurance options
77
86
  def display_insurance_options(insurance_options=None):
78
87
 
79
- # Define insurance options with codes and descriptions
80
- insurance_options = {
81
- "11": "Other Non-Federal Programs",
82
- "12": "Preferred Provider Organization (PPO)",
83
- "13": "Point of Service (POS)",
84
- "14": "Exclusive Provider Organization (EPO)",
85
- "15": "Indemnity Insurance",
86
- "16": "Health Maintenance Organization (HMO) Medicare Risk",
87
- "17": "Dental Maintenance Organization",
88
- "AM": "Automobile Medical",
89
- "BL": "Blue Cross/Blue Shield",
90
- "CH": "Champus",
91
- "CI": "Commercial Insurance Co.",
92
- "DS": "Disability",
93
- "FI": "Federal Employees Program",
94
- "HM": "Health Maintenance Organization",
95
- "LM": "Liability Medical",
96
- "MA": "Medicare Part A",
97
- "MB": "Medicare Part B",
98
- "MC": "Medicaid",
99
- "OF": "Other Federal Program",
100
- "TV": "Title V",
101
- "VA": "Veterans Affairs Plan",
102
- "WC": "Workers Compensation Health Claim",
103
- "ZZ": "Mutually Defined"
104
- }
88
+ # Retrieve insurance options with codes and descriptions
89
+ config, _ = MediLink_ConfigLoader.load_configuration()
90
+ insurance_options = config['MediLink_Config'].get('insurance_options')
105
91
 
106
92
  print("\nInsurance Type Options:")
107
93
  for code, description in sorted(insurance_options.items()):