-
Notifications
You must be signed in to change notification settings - Fork 0
/
oa.py
157 lines (105 loc) · 3.14 KB
/
oa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import fileImport as f
import claimImport as c
import constantsMed as con
from os import system
from colorama import Fore, Back, Style
import globals as g
import oaFileImport as o
import SummaryModule as s
import inputModule as i
import DBModule as db
import os
import subprocess
database = db.database_class()
checkFile = "cleaned.csv"
inputFile = i.inputClass()
extract = f.fileClass()
fileType = inputFile.getFileType()
if fileType == "Extract":
fileToProcess = inputFile.getInput()
extract.openInput(fileToProcess)
if fileType == "Check":
checkFile = inputFile.getCheck()
system("clear")
print()
print(Fore.RED + "Please Select an Operation you wish to perform:")
print("")
print(Fore.MAGENTA + "[1] Run a new INSURANCE extract")
print(Fore.MAGENTA + "[2] Run a new MEDICARE extract")
print(Fore.MAGENTA + "[3] Delete Accession Numbers")
allowableKeys = ["1", "2", "3"]
while True:
menuPress = input()
if menuPress in allowableKeys:
if menuPress == "1":
break
if menuPress == "2":
g.mode = "M"
import constantsMed as con
break
if menuPress == "3":
database.deleteAccession()
break
system("clear")
print("Do you want to process Diagnosis Codes?")
print("[Y] [N]")
allowableKeys = ["y", "n"]
while True:
key = input()
if key in allowableKeys:
if key == "y":
break
if key == "n":
g.processDiagCodes = False
break
else:
continue
extract.parseForMed("MEDICARE", checkFile)
extract.parseForBlankIns("MEDICARE", checkFile)
extract.parseForBadSubID("M", checkFile)
extract.parseForBadAddress("M", checkFile)
extract.parseForRan(checkFile)
# extract.openInput("051520_042420through051220_ins2.csv")
#extract.fixAddress(checkFile)
claims = extract.get()
print(claims)
currentAccession = claims.iloc[con.FIRST_ROW, con.ACCESSION_NUMBER]
claim = c.claimClass()
oaFile = o.oaFileClass()
summary = s.summaryClass()
claimList = []
singleRecord = True
for i in range(len(claims)):
if claims.iloc[i, con.ACCESSION_NUMBER] == currentAccession:
claim.addRow(claims.loc[i])
else:
claimList.append(claim)
currentAccession = claims.iloc[i, con.ACCESSION_NUMBER]
claim = c.claimClass()
claim.addRow(claims.loc[i])
singleRecord = False
# last record, put it in list
if i == (len(claims) - 1):
claimList.append(claim)
#if singleRecord == True:
# claimList.append(claim)
summary.writeMast()
system("clear")
print()
print(Fore.YELLOW + "Processing New and Deleted from Database Claims")
numOfClaims = (len(claimList))
claimsProcessed = 1
for claim in claimList:
# claim.setMedicare()
claim.checkForLab("LP2")
claim.checkForLab("LP")
claim.getDiagCodes()
claim.loadPrices()
if g.processDiagCodes == True:
claim.setDaigCodes(numOfClaims, claimsProcessed)
claim.getInsInfo(numOfClaims, claimsProcessed)
oaFile.writeTestBlock(claim.rowList, claim.diagCodeList)
summary.writeClaim(claim, claim.diagCodeList)
claimsProcessed += 1
oaFile.closeOAFile()
summary.writePDF()