Skip to content

Commit

Permalink
feat: first version of improved prescription layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper Bollen authored and Casper Bollen committed May 7, 2024
1 parent 0b41b90 commit 66f17bf
Show file tree
Hide file tree
Showing 16 changed files with 4,681 additions and 557 deletions.
1,045 changes: 562 additions & 483 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
"build": "dotnet fable src/Client -o dist -e .jsx && npm run init-assets && vite build --outDir ./../deploy"
},
"devDependencies": {
"@types/node": "^20.9.1",
"@vitejs/plugin-react": "^4.2.0",
"autoprefixer": "^10.4.16",
"mocha": "^8.3.2",
"postcss": "^8.4.31",
"@types/node": "^20.12.7",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.19",
"mocha": "^8.4.0",
"postcss": "^8.4.38",
"remotedev": "^0.2.9",
"sass": "^1.69.5",
"vite": "^5.0.0"
"sass": "^1.76.0",
"vite": "^5.2.10"
},
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource/roboto": "^4.5.8",
"@mui/icons-material": "^5.11.11",
"@mui/material": "^5.11.11",
"@mui/x-data-grid": "^6.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.5",
"use-sync-external-store": "^1.2.0"
"@mui/icons-material": "^5.15.15",
"@mui/material": "^5.15.15",
"@mui/x-data-grid": "^6.19.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^8.0.7",
"use-sync-external-store": "^1.2.2"
}
}
55 changes: 36 additions & 19 deletions src/Client/Views/Prescribe.fs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ module Prescribe =
{|
scenarios: Deferred<Types.ScenarioResult>
updateScenario: Types.ScenarioResult -> unit
selectOrder : (Types.Scenario * Shared.Types.Order option) -> unit
selectOrder : (Types.Scenario * Types.Order option) -> unit
order: Deferred<(bool * string option * Order) option>
loadOrder: (string option * Order) -> unit
updateScenarioOrder : unit -> unit
Expand Down Expand Up @@ -292,10 +292,29 @@ module Prescribe =
else
$"{s} {sc.Shape} {dt}"

let ord =
sc.Order
let ord = sc.Order

let item icon prim sec =
let rows =
let cells row =
row
|> Array.map (fun cell ->
JSX.jsx $"""
<TableCell sx = { {| pt=1 |} }>
{cell |> typoGraphy}
</TableCell>
"""
)

sec
|> Array.map (fun row ->
JSX.jsx $"""
<TableRow sx={ {| border=0 |} }>
{cells row}
</TableRow>
"""
)

JSX.jsx
$"""
import Table from '@mui/material/Table';
Expand All @@ -308,20 +327,18 @@ module Prescribe =
<ListItemIcon>
{icon}
</ListItemIcon>
<Table padding="none" >
<TableBody>
<TableRow sx={ {| border=0; ``& td``={| borderBottom=0 |} |} }>
<TableCell >
{prim}
</TableCell>
</TableRow>
<TableRow sx={ {| border=0 |} }>
<TableCell sx = { {| pt=2 |} }>
{sec |> typoGraphy}
</TableCell>
</TableRow>
</TableBody>
</Table>
<TableContainer sx={ {| width="max-content" |} } >
<Table size="small" sx={ {| tableLayout="auto" |} } >
<TableBody>
<TableRow sx={ {| border=0; ``& td``={| borderBottom=0 |} |} }>
<TableCell >
{prim}
</TableCell>
</TableRow>
{rows}
</TableBody>
</Table>
</TableContainer>
</ListItem>
"""

Expand All @@ -332,7 +349,7 @@ module Prescribe =
<Typography variant="h6" >
{med}
</Typography>
<List sx={ {| width="100%"; maxWidth=800; bgcolor=Mui.Colors.Grey.``50`` |} }>
<List sx={ {| width="100%"; maxWidth=1200; bgcolor=Mui.Colors.Grey.``50`` |} }>
{
[|
item Mui.Icons.Notes (Terms.``Prescribe Prescription`` |> getTerm "Voorschrift") sc.Prescription
Expand Down Expand Up @@ -392,7 +409,7 @@ module Prescribe =
<React.Fragment>
<Stack direction="column" spacing={3}>
<Typography sx={ {| fontSize=14 |} } color="text.secondary" gutterBottom>
<Typography sx={ {| fontSize=14 |} } color="text.secondary" >
{Terms.``Prescribe Scenarios`` |> getTerm "Medicatie scenario's"}
</Typography>
{
Expand Down
1 change: 1 addition & 0 deletions src/Informedica.GenForm.Lib/Filter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module Filter =
let setPatient (pat : Patient) (filter : Filter) =
let pat =
pat
|> Patient.correctAdjustUnit
|> Patient.calcPMAge

{ filter with
Expand Down
8 changes: 8 additions & 0 deletions src/Informedica.GenForm.Lib/Patient.fs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ module Patient =
}


let correctAdjustUnit (pat : Patient) =
{ pat with
Weight =
pat.Weight
|> Option.map (ValueUnit.convertTo Units.Weight.kiloGram)
}


let calcPMAge (pat: Patient) =
{ pat with
PMAge =
Expand Down
19 changes: 12 additions & 7 deletions src/Informedica.GenOrder.Lib/Api.fs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ module Api =
Ok (ord, pr)
| Error (ord, _) when tryAgain &&
ord.Prescription |> Prescription.isContinuous |> not
->
->
{ pr with
DoseRule =
{ pr.DoseRule with
Expand Down Expand Up @@ -346,7 +346,7 @@ module Api =

let prs, prp, adm =
ord
|> Order.Print.printOrderToMd useAdjust ns
|> Order.Print.printOrderToTableFormat useAdjust true ns

{
No = i
Expand All @@ -355,9 +355,9 @@ module Api =
Name = pr.DoseRule.Generic
Shape = pr.DoseRule.Shape
Route = pr.DoseRule.Route
Prescription = prs |> replace
Preparation =prp |> replace
Administration = adm |> replace
Prescription = prs |> Array.map (Array.map replace)
Preparation = prp |> Array.map (Array.map replace)
Administration = adm |> Array.map (Array.map replace)
Order = Some ord
UseAdjust = useAdjust
}
Expand Down Expand Up @@ -391,11 +391,16 @@ module Api =
if prs |> Array.length <= 1 then prs
else
if prs
|> Array.filter (fun pr -> pr.Preparation |> String.notEmpty)
|> Array.filter (fun pr ->
pr.Preparation
|> Array.exists (Array.exists String.notEmpty))
|> Array.length = 0 then prs
else
prs
|> Array.filter (fun pr -> pr.Preparation |> String.notEmpty)
|> Array.filter (fun pr ->
pr.Preparation
|> Array.exists (Array.exists String.notEmpty)
)

|]
|> Array.collect id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<None Include="Scripts\Api2.fsx" />
<None Include="Scripts\OrderVariable.fsx" />
<None Include="Scripts\Agent.fsx" />
<None Include="Scripts\Order.fsx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Informedica.GenCore.Lib\Informedica.GenCore.Lib.fsproj" />
Expand Down
Loading

0 comments on commit 66f17bf

Please sign in to comment.