medicafe 0.250820.5__py3-none-any.whl → 0.250820.6__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.py +13 -1
- MediBot/MediBot_Notepad_Utils.py +196 -0
- MediBot/__init__.py +1 -1
- MediCafe/__init__.py +1 -1
- MediLink/__init__.py +1 -1
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/METADATA +1 -1
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/RECORD +11 -10
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/LICENSE +0 -0
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/WHEEL +0 -0
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/entry_points.txt +0 -0
- {medicafe-0.250820.5.dist-info → medicafe-0.250820.6.dist-info}/top_level.txt +0 -0
MediBot/MediBot.py
CHANGED
@@ -12,6 +12,7 @@ except ImportError:
|
|
12
12
|
msvcrt = None # Not available on non-Windows systems
|
13
13
|
from collections import OrderedDict
|
14
14
|
from datetime import datetime # Added for primary surgery date logic
|
15
|
+
import MediBot_Notepad_Utils # For generating notepad files
|
15
16
|
|
16
17
|
# ============================================================================
|
17
18
|
# MINIMAL PROTECTION: Import State Validation
|
@@ -802,11 +803,22 @@ if __name__ == "__main__":
|
|
802
803
|
|
803
804
|
# Display existing patients table using the enhanced display function
|
804
805
|
patient_type = "MEDICARE" if is_medicare else "PRIVATE"
|
806
|
+
table_title = "{} PATIENTS - EXISTING: The following patient(s) already EXIST in the system but may have new dates of service.\n Their diagnosis codes may need to be updated manually by the user to the following list:".format(patient_type)
|
805
807
|
MediBot_UI.display_enhanced_patient_table(
|
806
808
|
patient_info,
|
807
|
-
|
809
|
+
table_title,
|
808
810
|
show_line_numbers=False
|
809
811
|
)
|
812
|
+
|
813
|
+
# Generate and open notepad file with existing patients table
|
814
|
+
try:
|
815
|
+
notepad_file_path = MediBot_Notepad_Utils.generate_existing_patients_notepad(patient_info, table_title)
|
816
|
+
if notepad_file_path:
|
817
|
+
print("Existing patients table saved and opened in notepad: {}".format(notepad_file_path))
|
818
|
+
else:
|
819
|
+
print("Warning: Could not create notepad file for existing patients table")
|
820
|
+
except Exception as e:
|
821
|
+
print("Warning: Error creating notepad file: {}".format(e))
|
810
822
|
|
811
823
|
# Update csv_data to exclude existing patients
|
812
824
|
# TODO: Update this logic to handle patients that exist but need new charges added.
|
@@ -0,0 +1,196 @@
|
|
1
|
+
# -*- coding: ascii -*-
|
2
|
+
"""
|
3
|
+
MediBot Notepad Utilities
|
4
|
+
Windows XP + Python 3.4.4 + ASCII-only compatible module for generating notepad files.
|
5
|
+
|
6
|
+
This module provides utilities to create and open text files containing patient table data
|
7
|
+
for manual review and reference.
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
import subprocess
|
12
|
+
import tempfile
|
13
|
+
from datetime import datetime
|
14
|
+
|
15
|
+
|
16
|
+
def format_patient_table_for_notepad(patient_info, title):
|
17
|
+
"""
|
18
|
+
Format patient table data for notepad display.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
patient_info: List of tuples (surgery_date, patient_name, patient_id, diagnosis_code, patient_row)
|
22
|
+
title: Title for the table section
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
str: Formatted text content suitable for notepad display
|
26
|
+
"""
|
27
|
+
if not patient_info:
|
28
|
+
return title + "\n\nNo patients found.\n"
|
29
|
+
|
30
|
+
lines = []
|
31
|
+
lines.append(title)
|
32
|
+
lines.append("")
|
33
|
+
|
34
|
+
# Normalize data to avoid None and unexpected container types in sort key
|
35
|
+
normalized_info = []
|
36
|
+
for surgery_date, patient_name, patient_id, diagnosis_code, patient_row in patient_info:
|
37
|
+
# Normalize date into comparable key and display string
|
38
|
+
display_date = None
|
39
|
+
current_date_dt = None
|
40
|
+
try:
|
41
|
+
if hasattr(surgery_date, 'strftime'):
|
42
|
+
display_date = surgery_date.strftime('%m-%d')
|
43
|
+
current_date_dt = surgery_date
|
44
|
+
elif isinstance(surgery_date, str):
|
45
|
+
# Date strings may be MM-DD-YYYY or already MM-DD
|
46
|
+
parts = surgery_date.split('-') if surgery_date else []
|
47
|
+
if len(parts) == 3 and all(parts):
|
48
|
+
display_date = "{}-{}".format(parts[0], parts[1])
|
49
|
+
try:
|
50
|
+
current_date_dt = datetime.strptime(surgery_date, '%m-%d-%Y')
|
51
|
+
except Exception:
|
52
|
+
current_date_dt = None
|
53
|
+
else:
|
54
|
+
display_date = surgery_date or 'Unknown Date'
|
55
|
+
current_date_dt = None
|
56
|
+
else:
|
57
|
+
display_date = str(surgery_date) if surgery_date is not None else 'Unknown Date'
|
58
|
+
current_date_dt = None
|
59
|
+
except Exception:
|
60
|
+
display_date = str(surgery_date) if surgery_date is not None else 'Unknown Date'
|
61
|
+
current_date_dt = None
|
62
|
+
|
63
|
+
# Normalize diagnosis display: only show "-Not Found-" when explicitly flagged as N/A
|
64
|
+
display_diagnosis = diagnosis_code
|
65
|
+
if diagnosis_code == 'N/A':
|
66
|
+
display_diagnosis = '-Not Found-'
|
67
|
+
elif not diagnosis_code or diagnosis_code.strip() == '':
|
68
|
+
display_diagnosis = '-Not Found-'
|
69
|
+
|
70
|
+
# Extract patient name parts for sorting
|
71
|
+
last_name_key = ''
|
72
|
+
first_name_key = ''
|
73
|
+
|
74
|
+
# Try to get last/first from patient_row if available
|
75
|
+
if patient_row:
|
76
|
+
try:
|
77
|
+
last_name_key = str(patient_row.get('Last Name', '')).upper()
|
78
|
+
first_name_key = str(patient_row.get('First Name', '')).upper()
|
79
|
+
except (AttributeError, TypeError):
|
80
|
+
pass
|
81
|
+
|
82
|
+
# Build primary date for this patient (used for grouping)
|
83
|
+
primary_date_dt = current_date_dt
|
84
|
+
|
85
|
+
# If last/first not available from row, parse from display name "LAST, FIRST ..."
|
86
|
+
if not last_name_key and isinstance(patient_name, str):
|
87
|
+
try:
|
88
|
+
parts = [p.strip() for p in patient_name.split(',')]
|
89
|
+
if len(parts) >= 1:
|
90
|
+
last_name_key = parts[0].upper()
|
91
|
+
if len(parts) >= 2:
|
92
|
+
first_name_key = parts[1].split()[0].upper() if parts[1] else ''
|
93
|
+
except Exception:
|
94
|
+
last_name_key = ''
|
95
|
+
first_name_key = ''
|
96
|
+
|
97
|
+
# Build composite sort key per requirement: by earliest date, then last name within date
|
98
|
+
composite_sort_key = (primary_date_dt, last_name_key, first_name_key, str(patient_id or ''))
|
99
|
+
|
100
|
+
normalized_info.append((composite_sort_key, display_date, str(patient_name or ''), str(patient_id or ''), display_diagnosis))
|
101
|
+
|
102
|
+
# Sort so that all entries for a patient are grouped under their earliest date
|
103
|
+
normalized_info.sort(key=lambda x: x[0])
|
104
|
+
|
105
|
+
# Calculate column widths for proper alignment
|
106
|
+
max_patient_id_len = max(len(pid) for _, _, _, pid, _ in normalized_info)
|
107
|
+
max_patient_name_len = max(len(pname) for _, _, pname, _, _ in normalized_info)
|
108
|
+
max_diagnosis_len = max(len(dcode) for _, _, _, _, dcode in normalized_info)
|
109
|
+
|
110
|
+
# Ensure minimum widths for readability
|
111
|
+
max_patient_id_len = max(max_patient_id_len, 10) # "Patient ID" header
|
112
|
+
max_patient_name_len = max(max_patient_name_len, 12) # "Patient Name" header
|
113
|
+
max_diagnosis_len = max(max_diagnosis_len, 9) # "Diagnosis" header
|
114
|
+
|
115
|
+
# Add table header
|
116
|
+
header_format = " {:<6} | {:<" + str(max_patient_id_len) + "} | {:<" + str(max_patient_name_len) + "} | {:<" + str(max_diagnosis_len) + "}"
|
117
|
+
lines.append(header_format.format("Date", "Patient ID", "Patient Name", "Diagnosis"))
|
118
|
+
|
119
|
+
# Add separator line
|
120
|
+
separator_format = " {:<6} | {:<" + str(max_patient_id_len) + "} | {:<" + str(max_patient_name_len) + "} | {:<" + str(max_diagnosis_len) + "}"
|
121
|
+
lines.append(separator_format.format("-" * 6, "-" * max_patient_id_len, "-" * max_patient_name_len, "-" * max_diagnosis_len))
|
122
|
+
|
123
|
+
current_patient = None
|
124
|
+
|
125
|
+
for sort_key, formatted_date, patient_name, patient_id, display_diagnosis in normalized_info:
|
126
|
+
if current_patient == patient_id:
|
127
|
+
patient_id_dashes = '-' * len(patient_id)
|
128
|
+
patient_name_dashes = '-' * len(patient_name)
|
129
|
+
secondary_format = " {:<6} | {:<" + str(max_patient_id_len) + "} | {:<" + str(max_patient_name_len) + "} | {:<" + str(max_diagnosis_len) + "}"
|
130
|
+
lines.append(secondary_format.format(formatted_date, patient_id_dashes, patient_name_dashes, display_diagnosis))
|
131
|
+
else:
|
132
|
+
current_patient = patient_id
|
133
|
+
primary_format = " {:<6} | {:<" + str(max_patient_id_len) + "} | {:<" + str(max_patient_name_len) + "} | {:<" + str(max_diagnosis_len) + "}"
|
134
|
+
lines.append(primary_format.format(formatted_date, patient_id, patient_name, display_diagnosis))
|
135
|
+
|
136
|
+
lines.append("")
|
137
|
+
lines.append("Generated on: {}".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
138
|
+
|
139
|
+
return "\n".join(lines)
|
140
|
+
|
141
|
+
|
142
|
+
def create_and_open_notepad_file(content, filename_prefix="existing_patients"):
|
143
|
+
"""
|
144
|
+
Create a text file with the given content and open it in notepad.
|
145
|
+
Compatible with Windows XP and Python 3.4.4.
|
146
|
+
|
147
|
+
Args:
|
148
|
+
content: Text content to write to the file
|
149
|
+
filename_prefix: Prefix for the generated filename
|
150
|
+
|
151
|
+
Returns:
|
152
|
+
str: Path to the created file, or None if an error occurred
|
153
|
+
"""
|
154
|
+
try:
|
155
|
+
# Generate a unique filename with timestamp
|
156
|
+
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
|
157
|
+
filename = "{}_{}.txt".format(filename_prefix, timestamp)
|
158
|
+
|
159
|
+
# Use the temp directory for the file
|
160
|
+
temp_dir = tempfile.gettempdir()
|
161
|
+
file_path = os.path.join(temp_dir, filename)
|
162
|
+
|
163
|
+
# Write the file with ASCII encoding for XP compatibility
|
164
|
+
with open(file_path, 'w') as f:
|
165
|
+
# Ensure content is ASCII-compatible
|
166
|
+
ascii_content = content.encode('ascii', 'replace').decode('ascii')
|
167
|
+
f.write(ascii_content)
|
168
|
+
|
169
|
+
# Open the file in notepad using Windows XP compatible method
|
170
|
+
try:
|
171
|
+
# Use subprocess to avoid shell=True security issues
|
172
|
+
subprocess.Popen(['notepad.exe', file_path])
|
173
|
+
except Exception:
|
174
|
+
# Fallback method for older systems
|
175
|
+
os.system('notepad.exe "{}"'.format(file_path))
|
176
|
+
|
177
|
+
return file_path
|
178
|
+
|
179
|
+
except Exception as e:
|
180
|
+
# Return None on error - caller should handle gracefully
|
181
|
+
return None
|
182
|
+
|
183
|
+
|
184
|
+
def generate_existing_patients_notepad(patient_info, title):
|
185
|
+
"""
|
186
|
+
Generate a notepad file for existing patients table.
|
187
|
+
|
188
|
+
Args:
|
189
|
+
patient_info: List of tuples (surgery_date, patient_name, patient_id, diagnosis_code, patient_row)
|
190
|
+
title: Title for the table section
|
191
|
+
|
192
|
+
Returns:
|
193
|
+
str: Path to the created file, or None if an error occurred
|
194
|
+
"""
|
195
|
+
content = format_patient_table_for_notepad(patient_info, title)
|
196
|
+
return create_and_open_notepad_file(content, "existing_patients")
|
MediBot/__init__.py
CHANGED
MediCafe/__init__.py
CHANGED
MediLink/__init__.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
MediBot/MediBot.bat,sha256=ZXYeUopUwsFsrk47aZiqFWVrttemjwz3vlDnKhjG76s,27120
|
2
|
-
MediBot/MediBot.py,sha256=
|
2
|
+
MediBot/MediBot.py,sha256=j6yGetDQxonIepD_J-bJ5L_WiW9XRxOkIHiVAM_blfE,47083
|
3
3
|
MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
MediBot/MediBot_Crosswalk_Library.py,sha256=jIaYdoxfT9YgQ5dWZC4jmTYxRX1Y14X-AJ6YEjR58Gc,25158
|
5
5
|
MediBot/MediBot_Crosswalk_Utils.py,sha256=hTLPioU9A5XfdTZ7LqeOiYXdsi8Bwf9fuMJGxofyTmg,38983
|
6
|
+
MediBot/MediBot_Notepad_Utils.py,sha256=fOsjyfoSpgmQyc8TcnLm53faLMOUUL18cspo5PZqJK4,8719
|
6
7
|
MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
8
|
MediBot/MediBot_Preprocessor.py,sha256=gQRVAWbRHx_PMK6a7q93tp7Z-Dhjn5r0lJz3d0wAzeU,19067
|
8
9
|
MediBot/MediBot_Preprocessor_lib.py,sha256=lyl2Q5V1MQHiZ54kmTYPxor3pm2gf8mAq-IwYu7FX2c,87236
|
@@ -11,7 +12,7 @@ MediBot/MediBot_dataformat_library.py,sha256=D46fdPtxcgfWTzaLBtSvjtozzZBNqNiODgu
|
|
11
12
|
MediBot/MediBot_debug.bat,sha256=F5Lfi3nFEEo4Ddx9EbX94u3fNAMgzMp3wsn-ULyASTM,6017
|
12
13
|
MediBot/MediBot_docx_decoder.py,sha256=gn7I7Ng5khVIzU0HTTOqi31YSSn1yW8Pyk-i_P9r1oA,32472
|
13
14
|
MediBot/MediBot_smart_import.py,sha256=Emvz7NwemHGCHvG5kZcUyXMcCheidbGKaPfOTg-YCEs,6684
|
14
|
-
MediBot/__init__.py,sha256=
|
15
|
+
MediBot/__init__.py,sha256=eRsRz2bCAdEA8aRI5pPC45sBqvsaxfAdH7DQC0UpS74,3192
|
15
16
|
MediBot/clear_cache.bat,sha256=F6-VhETWw6xDdGWG2wUqvtXjCl3lY4sSUFqF90bM8-8,1860
|
16
17
|
MediBot/crash_diagnostic.bat,sha256=j8kUtyBg6NOWbXpeFuEqIRHOkVzgUrLOqO3FBMfNxTo,9268
|
17
18
|
MediBot/f_drive_diagnostic.bat,sha256=4572hZaiwZ5wVAarPcZJQxkOSTwAdDuT_X914noARak,6878
|
@@ -21,7 +22,7 @@ MediBot/process_csvs.bat,sha256=4PnwLyLRqwZ_rIsd6MvtwOI21MDKKm4HMzNgFwvpPG0,3339
|
|
21
22
|
MediBot/update_json.py,sha256=vvUF4mKCuaVly8MmoadDO59M231fCIInc0KI1EtDtPA,3704
|
22
23
|
MediBot/update_medicafe.py,sha256=J5ktFGq6gTsov0NCrMhq3nmyiiIsUqnH28LoeDWg-hg,16072
|
23
24
|
MediCafe/MediLink_ConfigLoader.py,sha256=fNBFnPbh1YRVCs9WvZp6tPsKTUFzK3f38ePeUQ00QrQ,10161
|
24
|
-
MediCafe/__init__.py,sha256=
|
25
|
+
MediCafe/__init__.py,sha256=SFQi_kGsBa_haGw0hHg7md1ErHxM1NcuvyolEcXIidw,5721
|
25
26
|
MediCafe/__main__.py,sha256=mRNyk3D9Ilnu2XhgVI_rut7r5Ro7UIKtwV871giAHI8,12992
|
26
27
|
MediCafe/api_core.py,sha256=IZaBXnP4E7eHzxVbCk2HtxywiVBuhaUyHeaqss8llgY,66378
|
27
28
|
MediCafe/api_core_backup.py,sha256=Oy_Fqt0SEvGkQN1Oqw5iUPVFxPEokyju5CuPEb9k0OY,18686
|
@@ -60,7 +61,7 @@ MediLink/MediLink_insurance_utils.py,sha256=g741Fj2K26cMy0JX5d_XavMw9LgkK6hjaUJY
|
|
60
61
|
MediLink/MediLink_main.py,sha256=ZVK2UsgSxC9UqgIYfgVu95ugULcH6-11l67jsf4vdJc,22132
|
61
62
|
MediLink/MediLink_smart_import.py,sha256=B5SfBn_4bYEWJJDolXbjnwKx_-MaqGZ76LyXQwWDV80,9838
|
62
63
|
MediLink/Soumit_api.py,sha256=5JfOecK98ZC6NpZklZW2AkOzkjvrbYxpJpZNH3rFxDw,497
|
63
|
-
MediLink/__init__.py,sha256=
|
64
|
+
MediLink/__init__.py,sha256=FNXbuB0evwhJciZtEiX3-zMrMDtyHwji1jdojfL_lAA,3888
|
64
65
|
MediLink/gmail_http_utils.py,sha256=gtqCCrzJC7e8JFQzMNrf7EbK8na2h4sfTu-NMaZ_UHc,4006
|
65
66
|
MediLink/gmail_oauth_utils.py,sha256=Ugr-DEqs4_RddRMSCJ_dbgA3TVeaxpbAor-dktcTIgY,3713
|
66
67
|
MediLink/insurance_type_integration_test.py,sha256=pz2OCXitAznqDciYn6OL9M326m9CYU7YiK-ynssdQ5g,15172
|
@@ -70,9 +71,9 @@ MediLink/test_cob_library.py,sha256=wUMv0-Y6fNsKcAs8Z9LwfmEBRO7oBzBAfWmmzwoNd1g,
|
|
70
71
|
MediLink/test_timing.py,sha256=yH2b8QPLDlp1Zy5AhgtjzjnDHNGhAD16ZtXtZzzESZw,2042
|
71
72
|
MediLink/test_validation.py,sha256=FJrfdUFK--xRScIzrHCg1JeGdm0uJEoRnq6CgkP2lwM,4154
|
72
73
|
MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
|
73
|
-
medicafe-0.250820.
|
74
|
-
medicafe-0.250820.
|
75
|
-
medicafe-0.250820.
|
76
|
-
medicafe-0.250820.
|
77
|
-
medicafe-0.250820.
|
78
|
-
medicafe-0.250820.
|
74
|
+
medicafe-0.250820.6.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
|
75
|
+
medicafe-0.250820.6.dist-info/METADATA,sha256=x6i0ZhWF8BsF6Ans7lBeisEeciKArw7MHB6-qxgbHNU,3414
|
76
|
+
medicafe-0.250820.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
77
|
+
medicafe-0.250820.6.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
|
78
|
+
medicafe-0.250820.6.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
|
79
|
+
medicafe-0.250820.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|