Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Add GitHub Pipelines #92

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f5b4cce
fix #70 - overwrite last_observed in indicators table by timeseries
mvarewyck Jan 22, 2024
afa03fd
version bump
mvarewyck Jan 22, 2024
67dd77d
fix #63 - vespa velutina if no data (e.g. january)
mvarewyck Jan 30, 2024
33a22e1
fix #63 - improve active hotbeds + example management linetype
mvarewyck Jan 30, 2024
19eedaf
fix #63 - add nestType and mgt to popup vespa + filter nest iAsset
mvarewyck Jan 31, 2024
0003faa
fix #63 - add trend management success of nesten vespa
mvarewyck Jan 31, 2024
7e0579f
fix #54 - include pre-filled text in contact email
mvarewyck Feb 1, 2024
66e9247
feature #77 - climate risk maps prototype
mvarewyck Feb 6, 2024
5197c9a
WIP #76 - shared gewest filter for species tab
Feb 8, 2024
a2408b7
WIP#76 - remove gewest filter plotTriasServer
mvarewyck Feb 8, 2024
41a3bdb
WIP #76 - update search link species
mvarewyck Feb 8, 2024
de2d133
review #76 + R CMD check
mvarewyck Feb 9, 2024
ba75409
Merge pull request #78 from inbo/feature#76
mvarewyck Feb 9, 2024
8b18f3d
fix #73 - initial version map + include in UI
mvarewyck Feb 20, 2024
6ae7e83
fix #73 - initial version of map + include in UI for vespa
mvarewyck Feb 20, 2024
971c705
fix #73 - add map for type 3 mgt species
mvarewyck Feb 20, 2024
72d1c6f
fix #73 - year gaps + R CMD check + gewest filter
mvarewyck Feb 20, 2024
6d9e0c6
fix vespa UI mapHeat if no data
mvarewyck Feb 20, 2024
cc72c61
fix #72 - better styling of taxa table and filters
mvarewyck Feb 21, 2024
829d7b8
fix #75 - include species report WIP
mvarewyck Feb 22, 2024
bfd7945
fix #75 - include both logos in report
mvarewyck Feb 22, 2024
d2d4b1c
fix #75 - include observations and indicators in report
mvarewyck Feb 27, 2024
469fb8c
fix #75 - include reporting graphs in report
mvarewyck Mar 6, 2024
acee7d7
speed improvements + render indicator tabs upon need
mvarewyck Mar 7, 2024
ead929e
clean code for R CMD check + link using taxonkey
mvarewyck Mar 11, 2024
f751e30
add git hash version cfr grofwild page
mvarewyck Mar 11, 2024
16ac28f
landscape leaflet maps in report
mvarewyck Mar 12, 2024
a233b0c
lightweight docker (no packamon) + speed up app using arrow
mvarewyck Mar 13, 2024
3ce7154
error message when no data available
mvarewyck Mar 13, 2024
dd72121
fix #75 - include reporting map in pdf when hidden
mvarewyck Mar 13, 2024
f67fe62
fix #75 - more generic report parameters + mgt type 1
mvarewyck Mar 13, 2024
42da27f
fix #75 - report for mgt + titles
mvarewyck Mar 20, 2024
89bf20d
fix #75 - include plots vespa velutina in report
mvarewyck Mar 25, 2024
a04ffcc
fix #75 - switching species mgt + R CMD check
mvarewyck Mar 26, 2024
7b4887c
speed up observations plot
mvarewyck Mar 26, 2024
e0fd0c5
change r version
SanderDevisscher Mar 28, 2024
4301c26
fix #74 - increase version rocker/r-ver
mvarewyck Mar 29, 2024
85ae9c9
fix #74 - docker for ARM64
mvarewyck Apr 8, 2024
c8a43f0
handle NA values for translations
mvarewyck Apr 10, 2024
0933597
fix #91 - handle no actieve haarden vespa velutina
mvarewyck Apr 12, 2024
e374c8f
fix #90 - add filter for region scale
mvarewyck Apr 12, 2024
a22fa98
fix #84 - add occupancy gam
mvarewyck Apr 16, 2024
77f690a
fix #74 - conflict config::get for gam
mvarewyck Apr 22, 2024
9a33749
:rocket: Add GitHub Pipelines
TheJenne18 Apr 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/deployment_uat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: [push, pull_request]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trigger is iedere push & pull_request ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hoe bepaal je de eindbestemming ? merge met uat -> uat omgeving ? merge met main -> prd omgeving ?

jobs:
build:
name: Build and upload Docker image
runs-on: [self-hosted]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: inbo-exotenportaal-portal
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ alienSpecies/alienSpecies-tests/

# aws secret
/script/

# temporary translations file
/alienSpecies/inst/extdata/translations.csv
252 changes: 38 additions & 214 deletions Dockerfile

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@ Enkele relevante URLS:
# Build/Run docker image

The dockerfile needs to be updated only when some of the **dependencies** for `alienSpecies` changed.
This file is generated automatically by packamon: please do not edit by hand.
The following commands are run to update this dockerfile.

```
if (!require(packamon))
install.packages("packamon", repos = c(rdepot = "https://repos.openanalytics.eu/repo/public", getOption("repos")))
library(packamon)
writeDockerfile(sourceDir = ".", installSource = TRUE,
overwrite = TRUE, shinyFunction = "alienSpecies::runShiny()")
```

Then, to build the docker image with the latest dockerfile, run in bash
To build the docker image with the latest dockerfile, run in bash

```
cd git/alien-species-portal
docker build -t inbo/alienspecies .
docker build --build-arg GIT_SHA=$(git rev-parse HEAD) -t inbo/alienspecies .
```

Run the new docker image from bash. You need to point docker to the .aws folder on your local system to retrieve the credentials.
Expand Down
26 changes: 15 additions & 11 deletions alienSpecies/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Package: alienSpecies
Type: Package
Title: Portal for alien and invasive species indicators
Version: 0.0.5
Version: 1.0.0
Date: 2023-11-30
Author: Machteld Varewyck, Yingjie Zhang, Eva Adriaensen
Maintainer: Machteld Varewyck <[email protected]>
Description: INBO shiny application based on the TRIAS package.
Encoding: UTF-8
License: MIT + file LICENSE
Imports:
arrow,
aws.ec2metadata,
aws.s3,
aws.signature,
Expand All @@ -17,28 +18,31 @@ Imports:
dplyr,
DT,
ggplot2,
ggspatial,
htmltools,
htmlwidgets,
httr,
INBOtheme (<= 0.5.9),
jsonlite,
leaflet,
leaflet (>= 2.2.0),
leaflet.extras,
methods,
plotly,
reshape2,
rgbif,
shiny,
shinycssloaders,
sf,
testthat (>= 3.0.0),
shiny,
shinycssloaders,
sf,
terra,
testthat (>= 3.0.0),
tidyr,
tidyverse,
trias (>= 2.0.3),
webshot,
xtable
tidyverse,
trias (>= 2.0.8),
webshot,
xtable
Suggests:
shinyjs
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Remotes:
inbo/[email protected],
trias-project/[email protected]
Expand Down
29 changes: 28 additions & 1 deletion alienSpecies/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(barplotLenteNesten)
export(checkS3)
export(combineActiveData)
export(combineNestenData)
export(combineVespaData)
export(comboTreeInput)
export(countNestenServer)
export(countNestenUI)
Expand All @@ -24,8 +25,8 @@ export(createSummaryNesten)
export(createSummaryRegions)
export(createTabularData)
export(createTaxaChoices)
export(createTaxaChoices2)
export(createTimeseries)
export(decodeText)
export(displayName)
export(downloadS3)
export(drawBullet)
Expand All @@ -34,6 +35,7 @@ export(filterSelectServer)
export(filterSelectUI)
export(getDutchNames)
export(getGbifOccurrence)
export(getPathLogo)
export(loadGbif)
export(loadMetaData)
export(loadOccupancyData)
Expand All @@ -47,7 +49,11 @@ export(mapHeatServer)
export(mapHeatUI)
export(mapOccurrence)
export(mapPopup)
export(mapRaster)
export(mapRasterServer)
export(mapRasterUI)
export(mapRegions)
export(mapRegionsFacet)
export(mapRegionsServer)
export(mapRegionsUI)
export(matchCombo)
Expand All @@ -59,12 +65,14 @@ export(plotModuleUI)
export(plotTrias)
export(plotTriasServer)
export(plotTriasUI)
export(plotlyReport)
export(readS3)
export(replicateColors)
export(runShiny)
export(setupS3)
export(simpleCap)
export(summarizeTimeSeries)
export(summarizeYearGroupData)
export(tableIndicators)
export(tableIndicatorsServer)
export(tableIndicatorsUI)
Expand All @@ -76,6 +84,8 @@ export(titleModuleUI)
export(translate)
export(trendYearRegion)
export(vectorToTitleString)
export(versionServer)
export(versionUI)
export(welcomeSectionServer)
export(welcomeSectionUI)
export(writeS3)
Expand All @@ -96,6 +106,9 @@ importFrom(INBOtheme,inbo_lichtgrijs)
importFrom(INBOtheme,inbo_palette)
importFrom(INBOtheme,inbo_steun_blauw)
importFrom(INBOtheme,theme_inbo)
importFrom(arrow,open_dataset)
importFrom(arrow,read_parquet)
importFrom(arrow,write_parquet)
importFrom(aws.ec2metadata,is_ec2)
importFrom(aws.ec2metadata,metadata)
importFrom(aws.s3,get_bucket_df)
Expand All @@ -119,7 +132,10 @@ importFrom(data.table,setDT)
importFrom(data.table,setkey)
importFrom(data.table,setkeyv)
importFrom(data.table,setnames)
importFrom(data.table,year)
importFrom(dplyr,all_of)
importFrom(dplyr,case_when)
importFrom(dplyr,collect)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,mutate)
Expand All @@ -128,15 +144,21 @@ importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,ungroup)
importFrom(ggplot2,ggsave)
importFrom(ggspatial,annotation_map_tile)
importFrom(htmltools,div)
importFrom(htmlwidgets,saveWidget)
importFrom(httr,GET)
importFrom(httr,http_status)
importFrom(jsonlite,toJSON)
importFrom(leaflet,`%>%`)
importFrom(leaflet,addCircleMarkers)
importFrom(leaflet,addLegend)
importFrom(leaflet,addMarkers)
importFrom(leaflet,addRasterImage)
importFrom(leaflet,addScaleBar)
importFrom(leaflet,addTiles)
importFrom(leaflet,colorNumeric)
importFrom(leaflet,leaflet)
importFrom(leaflet,leafletOutput)
importFrom(leaflet,markerClusterOptions)
Expand All @@ -163,9 +185,14 @@ importFrom(shiny,singleton)
importFrom(shinycssloaders,withSpinner)
importFrom(stats,aggregate)
importFrom(stats,as.formula)
importFrom(stats,complete.cases)
importFrom(terra,rast)
importFrom(terra,values)
importFrom(testthat,test_file)
importFrom(tidyr,pivot_wider)
importFrom(utils,capture.output)
importFrom(utils,download.file)
importFrom(utils,packageVersion)
importFrom(utils,read.csv)
importFrom(utils,read.table)
importFrom(utils,tail)
Expand Down
59 changes: 38 additions & 21 deletions alienSpecies/R/app_modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#' User input for controlling specific plot (ui-side)
#' @param id character, module id, unique name per plot
#' @param showGroup boolean, whether to show a select input field for group variable
#' @param showSummary boolean, whether to show a select input field for summary choice
#' @param showPeriod boolean, whether to show a slider input field for period (first_observed)
#' @param showGewest boolean, whether to show filter for gewest
Expand All @@ -20,7 +19,7 @@
#' @return ui object (tagList)
#' @import shiny
#' @export
optionsModuleUI <- function(id, showGroup = FALSE, showSummary = FALSE,
optionsModuleUI <- function(id, showSummary = FALSE,
showPeriod = FALSE, showGewest = FALSE,
exportData = TRUE, doWellPanel = TRUE) {

Expand All @@ -31,8 +30,7 @@ optionsModuleUI <- function(id, showGroup = FALSE, showSummary = FALSE,
fixedRow(
if (showGewest)
column(6, uiOutput(ns("gewest"))),
if (showGroup)
column(6, uiOutput(ns("group"))),
column(6, uiOutput(ns("group"))),
if (showSummary)
column(6, uiOutput(ns("summarizeBy"))),
if (showPeriod)
Expand Down Expand Up @@ -65,8 +63,11 @@ plotModuleUI <- function(id, height = "600px") {

ns <- NS(id)

withSpinner(plotlyOutput(ns("plot"), height = height))

if (id == "management2_lente-plotTrias")
# dirty fix: this plot stays hidden when behind spinner
plotlyOutput(ns("plot"), height = height) else
withSpinner(plotlyOutput(ns("plot"), height = height))

}


Expand Down Expand Up @@ -103,6 +104,8 @@ tableModuleUI <- function(id, includeTotal = FALSE) {
#' @param data reactive data.frame, data for chosen species
#' @param period reactive numeric vector of length 2, selected period
#' @param combine reactive boolean, see \code{\link{trendYearRegion}}
#' @param groupChoices reactive character, defines the choices for group variable;
#' if NULL no groupChoices available
#' @return no return value; plot output object is created
#' @author mvarewyck
#' @import shiny
Expand All @@ -111,7 +114,7 @@ tableModuleUI <- function(id, includeTotal = FALSE) {
#' @importFrom plotly ggplotly layout
#' @export
plotModuleServer <- function(id, plotFunction, data, uiText = NULL,
outputType = NULL, triasFunction = NULL, triasArgs = NULL,
outputType = NULL, triasFunction = NULL, triasArgs = NULL, groupChoices = NULL,
period = NULL, combine = NULL) {

moduleServer(id,
Expand All @@ -131,11 +134,9 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,

output$group <- renderUI({

choices <- c("", "lifeStage")
names(choices) <- c("", translate(uiText(), choices[-1])$title)

selectInput(inputId = ns("group"), label = translate(uiText(), "group")$title,
choices = choices)
if (!is.null(groupChoices))
selectInput(inputId = ns("group"), label = translate(uiText(), "group")$title,
choices = groupChoices())

})

Expand All @@ -145,7 +146,7 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,
names(choices) <- translate(uiText(), choices)$title

selectInput(inputId = ns("summarizeBy"),
label = translate(uiText(), "summary")$title, choices = choices)
label = translate(uiText(), "summarizeBy")$title, choices = choices)

})

Expand Down Expand Up @@ -181,7 +182,7 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,

argList <- reactive({

req(nrow(subData()) > 0)
validate(need(nrow(subData()) > 0, translate(uiText(), "noData")$title))

argList <- c(
list(
Expand Down Expand Up @@ -214,8 +215,11 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,

resultFct <- reactive({

toReturn <- tryCatch(
do.call(plotFunction, args = argList()),
req(argList())

toReturn <- tryCatch({
do.call(plotFunction, args = argList())
},
error = function(err)
validate(need(FALSE, err$message))
)
Expand All @@ -226,8 +230,9 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,

})


output$plot <- renderPlotly({
finalPlot <- reactive({

req(resultFct())

if (!is.null(triasFunction) && triasFunction == "apply_gam") {
# remove title
Expand All @@ -239,9 +244,12 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,
} else resultFct()$plot

})

if (!(plotFunction == "countOccupancy" |
(!is.null(triasFunction) && triasFunction %in% c("barplotLenteNesten", "countNesten"))))


output$plot <- renderPlotly(finalPlot())


if (plotFunction != "countOccupancy" & plotFunction != "countOccurrence")
outputOptions(output, "plot", suspendWhenHidden = FALSE)


Expand Down Expand Up @@ -286,6 +294,15 @@ plotModuleServer <- function(id, plotFunction, data, uiText = NULL,

})


reactive(c(
list(plot = if (!is.null(outputType) && outputType == "table")
req(resultFct()) else
req(finalPlot())
),
reactiveValuesToList(input)
))

})

}
Expand Down
Loading
Loading