Skip to content

Commit

Permalink
Merge pull request #98 from hedayatbehnam/arg-pkg
Browse files Browse the repository at this point in the history
DbaaS debuggin
  • Loading branch information
hedayatbehnam authored Mar 18, 2023
2 parents 1a4360a + 3176786 commit f7e84c1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/mariadb-connection.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [test]
branches: [arg-pkg]

name: MariaDB-Connection

Expand All @@ -13,7 +13,6 @@ jobs:
host port: 3306 # Optional, default value is 3306. The port of host
container port: 3306 # Optional, default value is 3306. The port of container
character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
mysql root password: ${{ secrets.MARIADB_PW }} # Required if "mysql user" is empty, default is empty. The root superuser password
mysql user: ${{ secrets.MARIADB_USR }} # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
mysql password: ${{ secrets.MARIADB_PW }} # Required if "mysql user" exists. The password for the "mysql user"

3 changes: 0 additions & 3 deletions R/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ sample_cred <- data.frame(
permissions = c("admin", "standard"),
stringsAsFactors = F
)

tryCatch({mariadb_connect()}, error = function(e) print(e))
credentials <- tryCatch({mariadb_connect()}, error = function(e) return (sample_cred))
3 changes: 2 additions & 1 deletion R/mariadb_connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ mariadb_connect <- function(...,
}



conn <- dbConnect(RMariaDB::MariaDB(), user="behnam", password="111111",
dbname="test_db", host="localhost", port="3306")
13 changes: 13 additions & 0 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,23 @@ server <- function(input, output, session) {
if (input$login > 0) {
Username <- isolate(input$userName)
Password <- isolate(input$passwd)
db <- suppressWarnings(system("printenv MARIADB_DB", intern = T))
usr <- suppressWarnings(system("printenv MARIADB_USR", intern = T))
tbl <- suppressWarnings(system("printenv MARIADB_TBL", intern = T))
pass <- suppressWarnings(system("printenv MARIADB_PW", intern = T))
host <- suppressWarnings(system("printenv MARIADB_HOST", intern = T))
port <- suppressWarnings(system("printenv MARIADB_PORT", intern = T))

tryCatch({conn <- dbConnect(RMariaDB::MariaDB(), user=usr, password=pass,
dbname=db, host= host, port=port)}, error=function(e) print(e))

credentials <- tryCatch({mariadb_connect()}, error = function(e) return (sample_cred))

if(length(which(credentials$username_id==Username))==1) {
pasmatch <- credentials["passod"][which(credentials$username_id==Username),]
pasverify <- password_verify(pasmatch, Password)
if(pasverify) {
rm(credentials)
USER$login <- TRUE
} else {
shinyjs::toggle(id = "nomatch", anim = TRUE, time = 1, animType = "fade")
Expand Down
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
# PRIMACE Prediction Tool

<!-- badges: start -->

[![PRIMACE](man/figures/webapp.svg)](https://primace.aikadeh.com)

[![Continuous-Deployment](https://github.com/hedayatbehnam/primace/workflows/Continuous-Deployment/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![Docker-Build-Push](https://github.com/hedayatbehnam/primace/workflows/Docker-Build-Push/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![R-CMD-Check](https://github.com/hedayatbehnam/primace/workflows/R-CMD-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![S3-Bucket-Connection](https://github.com/hedayatbehnam/primace/workflows/S3-Bucket-Connection/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![Data-Modification-Check](https://github.com/hedayatbehnam/primace/workflows/Data-Modification-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![Webapp-Availability](https://github.com/hedayatbehnam/primace/workflows/Webapp-Availability/badge.svg)](https://github.com/hedayatbehnam/primace/actions)

[![Continuous-Deployment](https://github.com/hedayatbehnam/primace/workflows/Continuous-Deployment/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![Docker-Build-Push](https://github.com/hedayatbehnam/primace/workflows/Docker-Build-Push/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![R-CMD-Check](https://github.com/hedayatbehnam/primace/workflows/R-CMD-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![S3-Bucket-Connection](https://github.com/hedayatbehnam/primace/workflows/S3-Bucket-Connection/badge.svg)](https://github.com/hedayatbehnam/primace/actions)
[![Data-Modification-Check](https://github.com/hedayatbehnam/primace/workflows/Data-Modification-Check/badge.svg)](https://github.com/hedayatbehnam/primace/actions) [![Webapp-Availability](https://github.com/hedayatbehnam/primace/workflows/Webapp-Availability/badge.svg)](https://github.com/hedayatbehnam/primace/actions)

[![GitHub issues](https://img.shields.io/github/issues/hedayatbehnam/primace?color=blue&logo=github)](https://github.com/hedayatbehnam/primace/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/hedayatbehnam/primace?color=blue&logo=github)](https://github.com/hedayatbehnam/primace/pulls) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/hedayatbehnam/primace/blob/main/LICENSE.md)
[![Lifecycle:Experimental](https://img.shields.io/badge/Lifecycle-Experimental-339999)](<Redirect-URL>)

<!-- badges: end -->

## Overview
# Overview
`PRIMACE` is a shinyapp web application based on R language shiny package which can be used to predict major cardiovascular events (MACE) in first year following Primary Percutaneous Coronary Intervention (PPCI)
**PPCI:** Primary Percutaneous Coronary Intervention
**MACE:** Major Adverse Cardiovascular Events
Expand Down

0 comments on commit f7e84c1

Please sign in to comment.