File tree Expand file tree Collapse file tree 1 file changed +52
-2
lines changed
Expand file tree Collapse file tree 1 file changed +52
-2
lines changed Original file line number Diff line number Diff line change 11from parsers .sig import *
2+ import csv
23
3- parsed_sig = SigParser ().parse ('take 1-2 tabs by mouth qid x7d prn nausea' )
4- print (parsed_sig )
4+
5+ def main ():
6+ value = get_input ()
7+ generate_output (value )
8+
9+
10+ def get_input ():
11+ while True :
12+ try :
13+ value = int (
14+ input (
15+ "Enter [1] for a single sig. Enter [2] for bulk sigs via .csv file: "
16+ )
17+ )
18+ if value not in (1 , 2 ):
19+ pass
20+ else :
21+ return value
22+ except ValueError :
23+ pass
24+
25+
26+ def generate_output (n ):
27+ if n == 1 :
28+ sig = input ("Enter sig: " )
29+ print (SigParser ().parse (sig ))
30+
31+ else :
32+ while True :
33+ try :
34+ inputfile , outputfile = input ("Enter input.csv and output.csv: " ).split (
35+ " "
36+ )
37+ if inputfile .endswith (".csv" ) and outputfile .endswith (".csv" ):
38+ with open (inputfile , "r" ) as file :
39+ print (file )
40+ else :
41+ print ("Both files must end with .csv. Please try again." )
42+ except ValueError :
43+ pass
44+ except FileNotFoundError :
45+ print ("Input file not found. Please try again." )
46+ pass
47+
48+
49+ if __name__ == "__main__" :
50+ main ()
51+
52+
53+ # parsed_sig = SigParser().parse(x)
54+ # print(parsed_sig)
You can’t perform that action at this time.
0 commit comments