Compare commits

...

5 Commits

6 changed files with 57 additions and 23 deletions

View File

@ -1,3 +1,20 @@
# vistassh-py
Python-based web interface for VistA roll-and-scroll terminal
Python-based web interface for VistA roll-and-scroll terminal
## Getting started
You will need:
- Python 3.10+ & pip
- Node.js & npm
To install the dependencies and build the frontend, perform the following steps:
```bash
pip install -r requirements.txt
cd frontend
npm install
npm run build
```
To run, invoke `main.py`.

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// ')
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')
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:

View File

@ -1,7 +1,8 @@
export async function get_api_appointments({ fetch, clinics = [], date = 'T' } = {}) {
if(clinics.constructor === Array) clinics = clinics.map(x => x.replace(/^\s+|\s+$/g, '').replace(/\s+/, ' ')).filter(x => x).join('^').replace(/\//g, '|');
else clinics = clinics.replace(/^\s+|\s+$/g, '').replace(/\s+/, ' ').replace(/\//g, '|');
return await (await (fetch || window.fetch)('/api/appointments/' + clinics + '/' + date)).json();
if(clinics) return await (await (fetch || window.fetch)('/api/appointments/' + clinics + '/' + date)).json();
else return [];
}
export async function get_api_lookup({ fetch, query, ordinal, force = false } = {}) {

View File

@ -2,7 +2,12 @@ import { get_api_appointments } from '$lib/backend.js';
/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
let clinics = await (await fetch('/api/config/user/clinics')).json();
let clinics = [];
try {
clinics = await (await fetch('/api/config/user/clinics')).json();
} catch(ex) {
console.error(ex, ex.stack);
}
let appointments = await get_api_appointments({ fetch, clinics, date: 'T' });
appointments.sort((a, b) => a.time_scheduled < b.time_scheduled ? -1 : a.time_scheduled > b.time_scheduled ? 1 : 0);
return {

View File

@ -258,9 +258,7 @@
</th>
{#each component_groups as group, idx}<th class="date" class:first={ (idx == 0) || (group.key != component_groups[idx - 1].key) }><div class="year">{group.datestr.substring(0, 4)}</div><div class="monthdate">{group.datestr.substring(5)}</div>{#if false}<div class="hourminute daily">{datetime_timestr(group.values[0]._ts)}</div>{/if}</th>{/each}
</tr>
</thead>
{#if pattern}
<tbody>
{#if pattern}
{#each component_names as name}
{#if filter_test(pattern, name)}
<tr class="match">
@ -271,8 +269,10 @@
</tr>
{/if}
{/each}
</tbody>
<tbody>
{/if}
</thead>
<tbody>
{#if pattern}
{#each component_names as name}
{#if !filter_test(pattern, name)}
<tr>
@ -283,9 +283,7 @@
</tr>
{/if}
{/each}
</tbody>
{:else}
<tbody>
{:else}
{#each component_names as name}
<tr>
<th>{name}</th>
@ -294,8 +292,8 @@
{/each}
</tr>
{/each}
</tbody>
{/if}
{/if}
</tbody>
</table>
</div>
</div>

View File

@ -2,8 +2,12 @@
export async function load({ params, fetch }) {
let clinics = await (await fetch('/api/clinic/list')).json();
clinics.reduce((acc, item) => (acc[item.name] = item, acc), clinics);
let selection = await (await fetch('/api/config/user/clinics')).json();
selection.forEach(x => clinics[x] ? clinics[x].active = true : false);
try {
let selection = await (await fetch('/api/config/user/clinics')).json();
selection.forEach(x => clinics[x] ? clinics[x].active = true : false);
} catch(ex) {
console.error(ex, ex.stack);
}
return {
clinics
};