-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* issue-3: Title case for title Diagnosis as radio buttons (#4) Output as table (#4) Added calculation of HR for Fontan (#3) Simplified variable names Added calculation of HR for moderate (#3) Changed placeholders to NA (#3) Added calculation of heart rate for simple defects (#3)
- Loading branch information
Showing
2 changed files
with
46 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
server <- function(input, output) { | ||
# Calculate endpoints | ||
output$vo2_ml_min <- renderText({ | ||
vo2_ml_min() | ||
}) | ||
output$vo2_ml_kg_min <- renderText({ | ||
vo2_ml_kg_min() | ||
}) | ||
output$heart_rate <- renderText({ | ||
heart_rate() | ||
}) | ||
output$ventilation <- renderText({ | ||
ventilation() | ||
}) | ||
output$oxygen_pulse <- renderText({ | ||
oxygen_pulse() | ||
}) | ||
output$ve_vco2_slope <- renderText({ | ||
ve_vco2_slope() | ||
}) | ||
output$breathing_frequency <- renderText({ | ||
breathing_frequency() | ||
}) | ||
|
||
vo2_ml_min <- function() { | ||
1 | ||
NA | ||
} | ||
|
||
vo2_ml_kg_min <- function() { | ||
2 | ||
NA | ||
} | ||
|
||
heart_rate <- function() { | ||
3 | ||
heart_rate <- function(diagnosis, height, bmi, sex) { | ||
software <- 0.0469 # prop. of Vyntus on Fontan (only relevant case here) | ||
switch(diagnosis, | ||
simple = (9168804 * height + 5.13e9) ^ (1 / 4.3), | ||
moderate = (9.9e8 * height - 2.86e9 * bmi + 1.4e11) ^ (1 / 5), | ||
fontan = (-144400.5 * height - 3.81e7 * sex + 2076971 * bmi * sex + 1.24e7 * software + 9.75e7) ^ (1 / 3.5) | ||
) | ||
} | ||
|
||
ventilation <- function() { | ||
4 | ||
NA | ||
} | ||
|
||
oxygen_pulse <- function() { | ||
5 | ||
NA | ||
} | ||
|
||
ve_vco2_slope <- function() { | ||
6 | ||
NA | ||
} | ||
|
||
breathing_frequency <- function() { | ||
7 | ||
NA | ||
} | ||
|
||
output$results_table <- renderTable({ | ||
data.frame( | ||
"Metric" = c( | ||
"VO2 ml/min", "VO2 ml/kg/min", "Heart rate", "Ventilation", | ||
"Oxygen pulse", "VE/VCO2 slope", "Breathing frequency" | ||
), | ||
"Value" = c( | ||
vo2_ml_min(), | ||
vo2_ml_kg_min(), | ||
heart_rate(input$diagnosis, input$height, input$bmi, as.numeric(input$sex)), | ||
ventilation(), | ||
oxygen_pulse(), | ||
ve_vco2_slope(), | ||
breathing_frequency() | ||
) | ||
) | ||
}) | ||
} |
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