Fix error handling empty progress note ranges

This commit is contained in:
Jiang Yio 2024-04-10 21:29:18 -04:00
parent 6da6b70537
commit 6d2a7818db

View File

@ -31,15 +31,24 @@ async def cmd_reports(proc, mrn, alpha, omega):
proc.sendline(util.vista_strftime(omega))
assert await expect.endswith('\r\n Thru: ')
proc.sendline(util.vista_strftime(alpha))
assert await expect.endswith('\r\nDo you want WORK copies or CHART copies? CHART// ')
found = True
match await expect.endswith('\r\nDo you want WORK copies or CHART copies? CHART// ', '\r\nPrint Notes Beginning: '):
case autoproc.ExpectMatch(index=0):
proc.sendline() # default CHART
if await expect.endswith('\r\nDo you want to start each note on a new page? NO// '):
proc.sendline() # default NO
assert await expect.endswith('\r\nDEVICE: HOME// ')
proc.sendline('HOME;;1023')
assert await expect.earliest(' HOME(CRT)\r\n')
case autoproc.ExpectMatch(index=1):
proc.sendline('^')
assert await expect.endswith('\r\nSelect PATIENT NAME: ')
proc.sendline('^')
assert await expect.endswith('\r\nSelect Progress Notes Print Options Option: ')
found = False
case _: assert False
pages = []
while True:
while found:
match m_delimiter := await expect.endswith('\r\nType <Enter> to continue or \'^\' to exit: ', '\r\nSelect PATIENT NAME: '):
case autoproc.ExpectMatch(index=0, before=before):
if isnew(before) and len(pages) > 0: