Skip to content

Commit

Permalink
refacto : pruned trisk core model
Browse files Browse the repository at this point in the history
  • Loading branch information
bergalli committed May 13, 2024
1 parent 54cb731 commit 396ca88
Show file tree
Hide file tree
Showing 150 changed files with 349,309 additions and 0 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^LICENSE\.md$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
16 changes: 16 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
As a developer you'll need to set two enviornmental variables (e.g.
in .Renviron):

```
# Where to save project agnostic files?
# For example, see 2DII's Dropbox at
# PortCheck/00_Data/07_AnalysisInputs/ST_INPUTS_MASTER
ST_DATA_PATH=/a/path
# Where to save project specific inputs and outputs?
# For example, for bonds (fastest) see 2DII's Dropbox at
# PortCheck_v2/10_Projects/ST_TESTING_BONDS
ST_PROJECT_FOLDER_INPUT=/another/path/inputs
ST_PROJECT_FOLDER_OUTPUT=/another/path/outputs
```

51 changes: 51 additions & 0 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

timeout-minutes: 30

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
46 changes: 46 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
23 changes: 23 additions & 0 deletions .github/workflows/pr-check-file-encodings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: check file encodings in PR
on: [pull_request]
jobs:
file-encoding:
name: file encooding check
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: run the checkout action
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: list all changed files
run: |
files=$(git diff --name-only origin/$GITHUB_BASE_REF...${{ github.sha }})
IFS=$'\n'; files=($files); unset IFS; # split the string into an array
file --mime "${files[@]}"
- name: list all changed files with the wrong encoding
run: |
files=$(git diff --name-only origin/$GITHUB_BASE_REF...${{ github.sha }})
IFS=$'\n'; files=($files); unset IFS; # split the string into an array
! file --mime "${files[@]}" | grep -v "charset=utf-8\|charset=us-ascii\|charset=binary\| (No such file or directory)$"
76 changes: 76 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]

name: Commands

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: pr-document

- name: Document
run: Rscript -e 'roxygen2::roxygenise()'

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add man/\* NAMESPACE
git commit -m 'Document'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: r-lib/actions/setup-r@v2

- name: Install dependencies
run: Rscript -e 'install.packages("styler")'

- name: Style
run: Rscript -e 'styler::style_pkg()'

- name: commit
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add \*.R
git commit -m 'Style'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
paths:
- README.Rmd

name: Render README

jobs:
render:
name: Render README
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v1
- name: Install rmarkdown, remotes, and the local package
run: |
install.packages("remotes")
remotes::install_local(".")
remotes::install_cran("rmarkdown")
shell: Rscript {0}
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
- name: Commit results
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
git push origin || echo "No changes to commit"
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData

# User-specific files
.Ruserdata

# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

### MacOS specific ###
# Folder view configuration files
# Mac files
.DS_STORE
**/.DS_STORE
Desktop.ini
*.icloud
.Rproj.user
docs
tests/testthat/_snaps/run_trisk*
tests/testthat/_snaps/run_lrisk*
workspace/
.vscode
inst/doc
40 changes: 40 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Package: trisk.model
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: The package provides functions and workflows for conducting
financial stress tests of listed equity, corporate bond and corporate
loan portfolios. It specifically focuses on climate change related
risks, such as transition/policy risk, litigation risk and physical
risk. The methodologies developed by 2DII focus on forward looking
approaches and asset based analyses where possible. Some external
stress tests are also featured. This package is currently in the beta
stage and not finalised yet. Changes to the methodology will still be
made that can and will impact the outcomes of the analysis.
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Depends:
R (>= 3.4)
Imports:
dplyr,
fs,
glue,
magrittr,
purrr,
readr,
rlang,
tibble,
tidyr,
uuid,
zoo
Suggests:
rmarkdown,
r2dii.plot,
testthat (>= 3.0.0),
spelling,
knitr
Config/testthat/edition: 3
Loading

0 comments on commit 396ca88

Please sign in to comment.