-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deceased chart: split up code into separate F# files (#770)
- Loading branch information
Showing
5 changed files
with
99 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module DeceasedViz.Analysis | ||
|
||
type DisplayMetricsType = | ||
| HospitalsToDate | ||
| HospitalsToday | ||
| ByAgeToDate | ||
// | ByAgeToday | ||
|
||
type DisplayMetrics = { | ||
Id: string | ||
MetricsType: DisplayMetricsType | ||
ChartType: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module DeceasedViz.Synthesis | ||
|
||
open Data.Patients | ||
open DeceasedViz.Analysis | ||
|
||
type DeceasedVizState = { | ||
PatientsData : PatientsStats [] | ||
Metrics: DisplayMetrics | ||
RangeSelectionButtonIndex: int | ||
Error : string option | ||
} | ||
|
||
let subtract (a : int option) (b : int option) = | ||
match a, b with | ||
| Some aa, Some bb -> Some (bb - aa) | ||
| Some aa, None -> -aa |> Some | ||
| None, Some _ -> b | ||
| _ -> None | ||
|
||
let getPoint state series dataPoint : int option = | ||
match state.Metrics.MetricsType with | ||
| HospitalsToday -> | ||
match series with | ||
| DeceasedInIcu -> dataPoint.total.deceased.hospital.icu.today | ||
| DeceasedAcute -> | ||
dataPoint.total.deceased.hospital.today | ||
|> subtract dataPoint.total.deceased.hospital.icu.today | ||
| DeceasedCare -> dataPoint.total.deceasedCare.today | ||
| DeceasedOther -> | ||
dataPoint.total.deceased.today | ||
|> subtract dataPoint.total.deceased.hospital.today | ||
|> subtract dataPoint.total.deceasedCare.today | ||
| HospitalsToDate -> | ||
match series with | ||
| DeceasedInIcu -> dataPoint.total.deceased.hospital.icu.toDate | ||
| DeceasedAcute -> | ||
dataPoint.total.deceased.hospital.toDate | ||
|> subtract dataPoint.total.deceased.hospital.icu.toDate | ||
| DeceasedCare -> dataPoint.total.deceasedCare.toDate | ||
| DeceasedOther -> | ||
dataPoint.total.deceased.toDate | ||
|> subtract dataPoint.total.deceased.hospital.toDate | ||
|> subtract dataPoint.total.deceasedCare.toDate | ||
|
||
let getPointTotal state series dataPoint : int option = | ||
match state.Metrics.MetricsType with | ||
| HospitalsToday -> | ||
match series with | ||
| DeceasedInIcu -> dataPoint.total.deceased.hospital.icu.today | ||
| DeceasedAcute -> dataPoint.total.deceased.hospital.today | ||
| DeceasedCare -> dataPoint.total.deceasedCare.today | ||
| DeceasedOther -> dataPoint.total.deceased.today | ||
| HospitalsToDate -> | ||
match series with | ||
| DeceasedInIcu -> dataPoint.total.deceased.hospital.icu.toDate | ||
| DeceasedAcute -> dataPoint.total.deceased.hospital.toDate | ||
| DeceasedCare -> dataPoint.total.deceasedCare.toDate | ||
| DeceasedOther -> dataPoint.total.deceased.toDate |