This commit is contained in:
Jan Przybylski 2020-12-22 00:15:06 +01:00
parent 0f64f92b0d
commit 9288442304
6 changed files with 178 additions and 43 deletions

View File

@ -16,7 +16,8 @@ calculatorUI <- function(id){
sliderInput("slider2", strong("Największa średnica elementu stałego (w mm):"),min = 0, max = 200, value = 0), sliderInput("slider2", strong("Największa średnica elementu stałego (w mm):"),min = 0, max = 200, value = 0),
selectInput("select3",strong("Nieregularna wewnętrzna ściana torbieli:"),choices = list("Nie"=0,"Tak"=1),selected=0), selectInput("select3",strong("Nieregularna wewnętrzna ściana torbieli:"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select4",strong("Obecność cieni akustycznych:"),choices = list("Nie"=0,"Tak"=1),selected=0), selectInput("select4",strong("Obecność cieni akustycznych:"),choices = list("Nie"=0,"Tak"=1),selected=0),
actionButton("update" ,"Oblicz") actionButton("update" ,"Oblicz"),
downloadButton("report", "Generuj raport")
), ),
mainPanel( mainPanel(
@ -35,6 +36,36 @@ calculatorUI <- function(id){
} }
calculatorServer <- function(input, output, session) { calculatorServer <- function(input, output, session) {
output$report <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename = "raport.pdf",
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path(tempdir(), "report.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
p=0
if(as.numeric(input$slider2)>=50){
p=50
}
z=-5.3718+0.0354*as.numeric(input$slider1)+1.6159*as.numeric(input$select1)+1.1768*as.numeric(input$select2)+0.0697*p+0.9586*as.numeric(input$select3)-2.9486*as.numeric(input$select4)
x=round(1/(1+exp(-z)),3)
params <- list(n = input$slider1,k=input$slider2,l=input$select1,m=input$select2,p=input$select3,r=input$select4,z=x,y=)
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
)
output$selected_var <- renderText({ output$selected_var <- renderText({
input$update input$update

45
app/report.Rmd Normal file
View File

@ -0,0 +1,45 @@
---
title: "Dynamiczny raport"
output: pdf_document
params:
n: NA
k: NA
l: NA
m: NA
p: NA
r: NA
z: NA
y: NA
---
Wiek pacjenta(w latach):
`r params$n`
Największa średnica elementu stałego (w mm): `r params$k`
Obecność wodobrzusza:
```{r, echo=FALSE}
if(params$l==1) {print("Tak")}else {print("Nie")}
```
Obecność przepływu krwi w projekcji brodawkowatej:
```{r, echo=FALSE}
if(params$m==1) {print("Tak")}else {print("Nie")}
```
Nieregularna wewnętrzna ściana torbieli:
```{r, echo=FALSE}
if(params$p==1) {print("Tak")}else {print("Nie")}
```
Obecność cieni akustycznych:
```{r, echo=FALSE}
if(params$r==1) {print("Tak")}else {print("Nie")}
```
Surowa wartość predyktora:
```{r, echo=FALSE}
params$z
```
Klasa guza:
```{r, echo=FALSE}
if(params$z>0.1){print("złośliwy")}else{print("łagodny")}
```
Próg złośliwości: 0.1

19
app/report.aux Normal file
View File

@ -0,0 +1,19 @@
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand\BKM@entry[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}

BIN
app/report.pdf Normal file

Binary file not shown.

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="2f11f4d5-1593-4266-846c-71ac633cf58a" name="Default" comment=""> <list default="true" id="2f11f4d5-1593-4266-846c-71ac633cf58a" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/../app/app.R" beforeDir="false" afterPath="$PROJECT_DIR$/../app/app.R" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../app/calculator.R" beforeDir="false" afterPath="$PROJECT_DIR$/../app/calculator.R" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../app/login_module.R" beforeDir="false" afterPath="$PROJECT_DIR$/../app/login_module.R" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../app/profil_module.R" beforeDir="false" afterPath="$PROJECT_DIR$/../app/profil_module.R" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../app/www/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/../app/www/style.css" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -26,6 +26,13 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component> </component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="C:\software\intellij_idea\plugins\maven\lib\maven3" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectCodeStyleSettingsMigration"> <component name="ProjectCodeStyleSettingsMigration">
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
@ -33,35 +40,22 @@
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" /> <property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
</component> </component>
<component name="RunManager" selected="Application.TakeCareApp"> <component name="RunManager">
<configuration name="TASProjectApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> <configuration name="TakeCareApp" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="project.TASProjectApp" /> <option name="ALTERNATIVE_JRE_PATH" value="11" />
<module name="TAS_Project" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="project.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TakeCareApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="project.TakeCareApp" /> <option name="MAIN_CLASS_NAME" value="project.TakeCareApp" />
<module name="backend" /> <module name="backend" />
<extension name="coverage"> <extension name="coverage">
@ -80,6 +74,19 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="ArquillianTestNG" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="TEST_OBJECT" value="CLASS" />
<properties />
<listeners />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit"> <configuration default="true" type="JUnit" factoryName="JUnit">
<option name="TEST_OBJECT" value="class" /> <option name="TEST_OBJECT" value="class" />
<option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" /> <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
@ -87,7 +94,7 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin"> <configuration default="true" type="JetRunConfigurationType">
<module name="TakeCareApp_Backend" /> <module name="TakeCareApp_Backend" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" /> <option name="PROGRAM_PARAMETERS" />
@ -100,7 +107,7 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script"> <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
<module name="TakeCareApp_Backend" /> <module name="TakeCareApp_Backend" />
<option name="filePath" /> <option name="filePath" />
<option name="vmParameters" /> <option name="vmParameters" />
@ -143,13 +150,8 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </configuration>
<recent_temporary>
<list>
<item itemvalue="Application.TakeCareApp" />
<item itemvalue="Application.TASProjectApp" />
</list>
</recent_temporary>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SvnConfiguration"> <component name="SvnConfiguration">
<configuration /> <configuration />
</component> </component>
@ -160,6 +162,8 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1538657724296</updated> <updated>1538657724296</updated>
<workItem from="1608588877099" duration="112000" />
<workItem from="1608589030964" duration="1942000" />
</task> </task>
<servers /> <servers />
</component> </component>
@ -172,15 +176,30 @@
<is-autoscroll-to-source value="true" /> <is-autoscroll-to-source value="true" />
</todo-panel> </todo-panel>
</component> </component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="249" y="0" key="#Project_Structure" timestamp="1608590116186">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="249" y="0" key="#Project_Structure/0.0.1536.824@0.0.1536.824" timestamp="1608590116186" />
<state x="357" y="150" width="584" height="683" key="#TakeCareApp" timestamp="1608415357147"> <state x="357" y="150" width="584" height="683" key="#TakeCareApp" timestamp="1608415357147">
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1280" height="984" />
</state> </state>
<state x="357" y="150" width="584" height="683" key="#TakeCareApp/0.0.1280.984@0.0.1280.984" timestamp="1608415357147" /> <state x="357" y="150" width="584" height="683" key="#TakeCareApp/0.0.1280.984@0.0.1280.984" timestamp="1608415357147" />
<state x="223" y="0" width="1089" height="824" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1608590123302">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="223" y="0" width="1089" height="824" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1536.824@0.0.1536.824" timestamp="1608590123302" />
<state x="445" y="208" key="#com.intellij.ide.util.MemberChooser" timestamp="1608284675573"> <state x="445" y="208" key="#com.intellij.ide.util.MemberChooser" timestamp="1608284675573">
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1280" height="984" />
</state> </state>
<state x="445" y="208" key="#com.intellij.ide.util.MemberChooser/0.0.1280.984@0.0.1280.984" timestamp="1608284675573" /> <state x="445" y="208" key="#com.intellij.ide.util.MemberChooser/0.0.1280.984@0.0.1280.984" timestamp="1608284675573" />
<state x="498" y="221" key="#com.intellij.ide.util.TreeClassChooserDialog" timestamp="1608589130374">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="498" y="221" key="#com.intellij.ide.util.TreeClassChooserDialog/0.0.1536.824@0.0.1536.824" timestamp="1608589130374" />
<state x="515" y="359" key="#com.intellij.ide.util.projectWizard.JdkChooserPanel.MyDialog" timestamp="1608416401063"> <state x="515" y="359" key="#com.intellij.ide.util.projectWizard.JdkChooserPanel.MyDialog" timestamp="1608416401063">
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1280" height="984" />
</state> </state>
@ -190,26 +209,31 @@
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1280" height="984" />
</state> </state>
<state x="370" y="239" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1280.984@0.0.1280.984" timestamp="1608284351336" /> <state x="370" y="239" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1280.984@0.0.1280.984" timestamp="1608284351336" />
<state x="420" y="247" key="FileChooserDialogImpl" timestamp="1608416486787"> <state x="504" y="207" key="FileChooserDialogImpl" timestamp="1608588987971">
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="420" y="247" key="FileChooserDialogImpl/0.0.1280.984@0.0.1280.984" timestamp="1608416486787" /> <state x="420" y="247" key="FileChooserDialogImpl/0.0.1280.984@0.0.1280.984" timestamp="1608416486787" />
<state width="1237" height="144" key="GridCell.Tab.0.bottom" timestamp="1608474806471"> <state x="504" y="207" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1608588987971" />
<screen x="0" y="0" width="1280" height="984" /> <state width="1416" height="195" key="GridCell.Tab.0.bottom" timestamp="1608591962773">
<screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1237" height="144" key="GridCell.Tab.0.bottom/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" /> <state width="1237" height="144" key="GridCell.Tab.0.bottom/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" />
<state width="1237" height="144" key="GridCell.Tab.0.center" timestamp="1608474806471"> <state width="1416" height="195" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608591962773" />
<screen x="0" y="0" width="1280" height="984" /> <state width="1416" height="195" key="GridCell.Tab.0.center" timestamp="1608591962773">
<screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1237" height="144" key="GridCell.Tab.0.center/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" /> <state width="1237" height="144" key="GridCell.Tab.0.center/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" />
<state width="1237" height="144" key="GridCell.Tab.0.left" timestamp="1608474806471"> <state width="1416" height="195" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1608591962773" />
<screen x="0" y="0" width="1280" height="984" /> <state width="1416" height="195" key="GridCell.Tab.0.left" timestamp="1608591962773">
<screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1237" height="144" key="GridCell.Tab.0.left/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" /> <state width="1237" height="144" key="GridCell.Tab.0.left/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" />
<state width="1237" height="144" key="GridCell.Tab.0.right" timestamp="1608474806471"> <state width="1416" height="195" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1608591962773" />
<screen x="0" y="0" width="1280" height="984" /> <state width="1416" height="195" key="GridCell.Tab.0.right" timestamp="1608591962773">
<screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1237" height="144" key="GridCell.Tab.0.right/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" /> <state width="1237" height="144" key="GridCell.Tab.0.right/0.0.1280.984@0.0.1280.984" timestamp="1608474806471" />
<state width="1416" height="195" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1608591962773" />
<state x="231" y="66" key="SettingsEditor" timestamp="1608416474275"> <state x="231" y="66" key="SettingsEditor" timestamp="1608416474275">
<screen x="0" y="0" width="1280" height="984" /> <screen x="0" y="0" width="1280" height="984" />
</state> </state>
@ -220,4 +244,9 @@
</state> </state>
<state x="336" y="316" key="com.intellij.ide.util.TipDialog/0.0.1280.984@0.0.1280.984" timestamp="1608473085786" /> <state x="336" y="316" key="com.intellij.ide.util.TipDialog/0.0.1280.984@0.0.1280.984" timestamp="1608473085786" />
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/backend$TakeCareApp.ic" NAME="TakeCareApp Coverage Results" MODIFIED="1608590180059" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
<FILTER>project.*</FILTER>
</SUITE>
</component>
</project> </project>

11
backend/src/backend.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>