Skip to content

Commit e9b242e

Browse files
committed
v2.1
1 parent 130694d commit e9b242e

File tree

24 files changed

+809
-386
lines changed

24 files changed

+809
-386
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@ The repository is prepped for development using the nix package manager. The fol
1818
default.nix`
1919
```
2020

21-
To enable this, `direnv` VSCode extension should installed on the system, and the command `direnv allow` must be run in the root of the repository.
22-
23-
## To Do
24-
- [ ] Create deployment scripts
21+
To enable this, `direnv` VSCode extension should installed on the system, and the command `direnv allow` must be run in the root of the repository.

deploy/deploy.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ SSH_DEST=root@$SERVER_IP
1111

1212
#echo Container name is $NGINX_CONTAINER_NAME
1313

14+
ssh -T $SSH_DEST "rm -frd /tmp/radcalc && mkdir -p /tmp/radcalc"
15+
1416
echo Uploading script
1517
scp -r ./onserverscript.sh root@$SERVER_IP:/tmp/radcalc/
1618

1719
echo Uploading site
18-
scp -r ../src/site root@$SERVER_IP:/tmp/radcalc/
20+
scp -r ../build/** root@$SERVER_IP:/tmp/radcalc/
1921

2022
echo Running script
2123
ssh -T $SSH_DEST "bash /tmp/radcalc/onserverscript.sh"

deploy/onserverscript.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ echo Container name is $NGINX_CONTAINER_NAME
55

66
echo Copying site into volume
77
docker exec $NGINX_CONTAINER_NAME rm -rf /var/www/html/static_content/radcalcv2
8-
docker cp "/tmp/radcalc/site/" "$NGINX_CONTAINER_NAME:/var/www/html/static_content/radcalcv2"
8+
docker cp "/tmp/radcalc/" "$NGINX_CONTAINER_NAME:/var/www/html/static_content/radcalcv2"
99

1010
#rm -rd /tmp/radcalc
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script lang="ts">
2+
type Source = {
3+
url?:string,
4+
description:string
5+
}
6+
type Props = {
7+
sources?:Source[]
8+
}
9+
10+
let props:Props=$props();
11+
</script>
12+
13+
<div class="cols centered flex_shrink">
14+
<div class="small_footer">
15+
{#if props.sources}
16+
Sources: <br>
17+
<ol>
18+
{#each props.sources as source}
19+
<li>
20+
{#if source.url}
21+
<a href={source.url}>
22+
{source.description}
23+
</a>
24+
{:else}
25+
{source.description}
26+
{/if}
27+
</li>
28+
{/each}
29+
</ol>
30+
{/if}
31+
</div>
32+
<div>This software is made available under the <a href="license"> MIT License</a>.</div>
33+
</div>
34+
35+
<style>
36+
@import "../global.css";
37+
</style>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import type { MouseEventHandler } from "svelte/elements";
33
import { createWorker } from "tesseract.js";
44
5-
5+
let result:string|undefined=$state(undefined);
6+
67
let image_ingest: MouseEventHandler<HTMLButtonElement>=(e)=>{
78
console.debug(e);
89
//Powerscribe copy-paste only contains text/plain, so no point in using the more powerful "read" function
@@ -22,14 +23,19 @@
2223
let recognize = async function (image:Blob) {
2324
const worker = await createWorker('eng');
2425
const ret = await worker.recognize(image);
25-
console.log(ret.data.text);
26+
result=ret.data.text;
2627
await worker.terminate();
2728
};
2829
2930
</script>
3031

3132
<div>
3233
<button onclick={image_ingest}>Ingest image from clipboard</button>
34+
{#if result}
35+
<pre>
36+
{result}
37+
</pre>
38+
{/if}
3339
</div>
3440

3541
<style>

src/components/AscendingAorticDiameter/main.svelte

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import type { ChangeEventHandler } from "svelte/elements";
55
import { createText, createTextAD, type Result } from "./AA/text";
66
import { initialize_guesses, iterate_guesses, type Guesses } from "./AA";
7+
import Footer from "../@commons/footer.svelte";
78
89
onMount(
910
()=> {
@@ -224,20 +225,14 @@
224225
</div>
225226
</div>
226227

227-
<div class="cols centered flex_shrink">
228-
<div class="small_footer">
229-
Sources: <br>
230-
<ol>
231-
<li>
232-
<a href="https://pubmed.ncbi.nlm.nih.gov/19423293/">
233-
P. Biaggi, F. Matthews, J. Braun, V. Rousson, P. A. Kaufmann, and R. Jenni, "Gender, Age, and Body Surface Area are the Major Determinants of Ascending Aorta Dimensions in Subjects With Apparently Normal Echocardiograms," Journal of the American Society of Echocardiography, vol. 22, no. 6, pp. 720-725, Jun. 2009.
234-
</a>
235-
</li>
236-
</ol>
237-
</div>
238-
239-
<div>This software is made available under the <a href="license"> MIT License</a>.</div>
240-
</div>
228+
<Footer sources={
229+
[
230+
{
231+
url: "https://pubmed.ncbi.nlm.nih.gov/19423293/",
232+
description: 'P. Biaggi, F. Matthews, J. Braun, V. Rousson, P. A. Kaufmann, and R. Jenni, "Gender, Age, and Body Surface Area are the Major Determinants of Ascending Aorta Dimensions in Subjects With Apparently Normal Echocardiograms," Journal of the American Society of Echocardiography, vol. 22, no. 6, pp. 720-725, Jun. 2009.'
233+
}
234+
]
235+
}/>
241236
</div>
242237

243238
<style>

src/components/DEXA/dexa_comparison.svelte

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import type { DEXA_Comparison } from "./ts/dexa/basic_types";
33
import { mdiLock } from "@mdi/js";
44
import { mdiLockOpenVariant } from "@mdi/js";
5-
5+
import Lock from "./lock.svelte";
6+
67
type Props = {
78
used:boolean,
89
name:string,
@@ -26,19 +27,7 @@
2627
<tr>
2728
<td>{name}</td>
2829
<td class="centered">
29-
{#if comparison.locked}
30-
<button class="iconbutton locked" aria-label={"Unlock " + name} onclick={lock_click}>
31-
<svg viewBox="0 0 24 24">
32-
<path class="iconsvg" d={mdiLock}/>
33-
</svg>
34-
</button>
35-
{:else}
36-
<button class="iconbutton" aria-label={"Lock " + name} onclick={lock_click}>
37-
<svg viewBox="0 0 24 24">
38-
<path class="iconsvg" d={mdiLockOpenVariant}/>
39-
</svg>
40-
</button>
41-
{/if}
30+
<Lock name={name} bind:locked={comparison.locked}/>
4231
</td>
4332
<td class="centered"><input type="number" class="numberbox" disabled={comparison.locked} step=0.001 bind:value={comparison.bone_mineral_density_absolute_change}></td>
4433
<td class="centered"><input type="number" class="numberbox" disabled={comparison.locked} step=0.01 bind:value={comparison.bone_mineral_density_percentage_change}></td>

src/components/DEXA/dexa_measurements.svelte

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script lang="ts">
22
import type { DEXA_Measurements } from "./ts/dexa/basic_types";
3-
import { mdiLock } from "@mdi/js";
4-
import { mdiLockOpenVariant } from "@mdi/js";
3+
import Lock from "./lock.svelte";
54
65
type Props = {
76
used:boolean,
@@ -26,19 +25,7 @@
2625
<tr>
2726
<td>{name}</td>
2827
<td class="centered">
29-
{#if measurements.locked}
30-
<button class="iconbutton locked" aria-label={"Unlock " + name} onclick={lock_click}>
31-
<svg viewBox="0 0 24 24">
32-
<path class="iconsvg" d={mdiLock}/>
33-
</svg>
34-
</button>
35-
{:else}
36-
<button class="iconbutton" aria-label={"Lock " + name} onclick={lock_click}>
37-
<svg viewBox="0 0 24 24">
38-
<path class="iconsvg" d={mdiLockOpenVariant}/>
39-
</svg>
40-
</button>
41-
{/if}
28+
<Lock name={name} bind:locked={measurements.locked}/>
4229
</td>
4330
<td class="centered"><input type="number" class="numberbox" disabled={measurements.locked} step=0.001 bind:value={measurements.bone_mineral_density}></td>
4431
<td class="centered"><input type="number" class="numberbox" disabled={measurements.locked} step=0.01 bind:value={measurements.t_score}></td>

src/components/DEXA/lock.svelte

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<script lang="ts">
2+
import { mdiLock } from "@mdi/js";
3+
import { mdiLockOpenVariant } from "@mdi/js";
4+
5+
type Props = {
6+
name:string,
7+
locked:boolean
8+
};
9+
let {
10+
name,
11+
locked = $bindable(),
12+
}:Props = $props();
13+
14+
const lock_click = function(){
15+
locked=!locked;
16+
}
17+
</script>
18+
19+
{#if locked}
20+
<button class="iconbutton locked" aria-label={"Unlock " + name} onclick={lock_click}>
21+
<svg viewBox="0 0 24 24">
22+
<path class="iconsvg" d={mdiLock}/>
23+
</svg>
24+
</button>
25+
{:else}
26+
<button class="iconbutton" aria-label={"Lock " + name} onclick={lock_click}>
27+
<svg viewBox="0 0 24 24">
28+
<path class="iconsvg" d={mdiLockOpenVariant}/>
29+
</svg>
30+
</button>
31+
{/if}
32+
33+
<style>
34+
.iconbutton{
35+
border-radius: 50%;
36+
width:48px;
37+
height:48px;
38+
align-self: center;
39+
margin:2px;
40+
}
41+
.iconbutton.locked{
42+
border-width: 2px;
43+
background-color: gray;
44+
}
45+
.iconsvg{
46+
fill:none;
47+
stroke:black;
48+
stroke-width:2;
49+
}
50+
51+
</style>

0 commit comments

Comments
 (0)