From 269a55b304abc9a4f02f980528c527ee3b79f8fc Mon Sep 17 00:00:00 2001 From: cbernalz Date: Sat, 27 Jul 2024 02:02:13 -0700 Subject: [PATCH] 2024-07-27 update : paged tutorials and rmv compat and tagbot. --- .github/workflows/CI.yml | 19 ++--- .github/workflows/CompatHelper.yml | 16 ---- .github/workflows/TagBot.yml | 31 ------- Project.toml | 1 + docs/make.jl | 10 ++- docs/src/tutorial.md | 85 ------------------- docs/src/tutorial_index.md | 11 +++ .../tutorials/agent_based_simulation_data.md | 32 +++++++ docs/src/tutorials/getting_started.md | 15 ++++ .../tutorials/uciwweihr_simulation_data.md | 47 ++++++++++ src/UCIWWEIHR.jl | 3 +- src/generate_simulation_data_agent.jl | 4 +- test/runtests.jl | 3 - 13 files changed, 124 insertions(+), 153 deletions(-) delete mode 100644 .github/workflows/CompatHelper.yml delete mode 100644 .github/workflows/TagBot.yml delete mode 100644 docs/src/tutorial.md create mode 100644 docs/src/tutorial_index.md create mode 100644 docs/src/tutorials/agent_based_simulation_data.md create mode 100644 docs/src/tutorials/getting_started.md create mode 100644 docs/src/tutorials/uciwweihr_simulation_data.md diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f26e9e8..b47bdb2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,10 +2,9 @@ name: CI on: push: branches: - - master + - main tags: ['*'] pull_request: - workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. @@ -15,31 +14,23 @@ jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} - timeout-minutes: 60 - permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created - actions: write - contents: read strategy: fail-fast: false matrix: version: - - '1.0' - '1.9' - - 'nightly' + - '1.10' + - '~1.11.0-0' os: - ubuntu-latest arch: - x64 steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - uses: julia-actions/cache@v1 - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v3 - with: - files: lcov.info + - uses: julia-actions/julia-runtest@v1 \ No newline at end of file diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml deleted file mode 100644 index cba9134..0000000 --- a/.github/workflows/CompatHelper.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: CompatHelper -on: - schedule: - - cron: 0 0 * * * - workflow_dispatch: -jobs: - CompatHelper: - runs-on: ubuntu-latest - steps: - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml deleted file mode 100644 index 2bacdb8..0000000 --- a/.github/workflows/TagBot.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: TagBot -on: - issue_comment: - types: - - created - workflow_dispatch: - inputs: - lookback: - default: 3 -permissions: - actions: read - checks: read - contents: write - deployments: read - issues: read - discussions: read - packages: read - pages: read - pull-requests: read - repository-projects: read - security-events: read - statuses: read -jobs: - TagBot: - if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' - runs-on: ubuntu-latest - steps: - - uses: JuliaRegistries/TagBot@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/Project.toml b/Project.toml index 71af86f..929b89d 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,7 @@ version = "1.0.0-DEV" [deps] AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/docs/make.jl b/docs/make.jl index f453632..b18cdb8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,10 +12,18 @@ makedocs(; format = Documenter.HTML(; prettyurls = get(ENV, "CI", "false") == "true", repolink = "https://cbernalz.github.io/UCIWWEIHR.jl", + size_threshold_warn = nothing, + size_threshold = nothing # Increase this value ), pages = [ "HOME" => "index.md", - "TUTORIAL" => "tutorial.md", + "TUTORIALS" => [ + "TUTORIAL CONTENTS" => "tutorial_index.md", + "GETTING STARTED" => "tutorials/getting_started.md", + "UCIWWEIHR SIMULATION DATA" => "tutorials/uciwweihr_simulation_data.md", + "AGENT-BASED SIMULATION DATA" => "tutorials/agent_based_simulation_data.md", + ] + , "NEWS" => "news.md", "PACKAGE DEVELOPMENT" => "package_development.md", "REFERENCE" => "reference.md", diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md deleted file mode 100644 index 6f17c0a..0000000 --- a/docs/src/tutorial.md +++ /dev/null @@ -1,85 +0,0 @@ -```@setup tutorial -using Plots; gr() -Plots.reset_defaults() -``` -# [Tutorials](@id tutorial) - -Welcome to the Tutorials page for the UCIWWEIHR.jl project. This section provides step-by-step guides and examples to help you get started with using the package and understanding its features. - -## 1. Getting Started. - -### 1.1 Installation. - -To install the UCIWWEIHR.jl package, open the Julia REPL and run the following command: - -``` julia -using Pkg -Pkg.add("UCIWWEIHR") -``` - -## 2. Generating simulated data with UCIWWEIHR ODE compartmental based model. - -This package provides a way to also simulate data using the UCIWWEIHR ODE compartmental based model specified in the future paper. The function called `generate_simulation_data_uciwweihr.jl` can be used to generate synthetic data for a given number of samples and features. Here we provide a demonstration using the default settings of `generate_simulation_data_uciwweihr.jl` : - -``` @example tutorial -using UCIWWEIHR -using Plots -# Running simulation function with defaults -df = generate_simulation_data_uciwweihr() -first(df, 5) -``` - -### 2.1. Visualizing UCIWWEIHR model results. - -Here we can make simple plots to visualize the data generated using the [Plots.jl](https://github.com/JuliaPlots/Plots.jl) package. - -### 2.1.1. Concentration of pathogen genome in wastewater(WW). -```@example tutorial -plot(df.obstimes, df.log_ww_conc, - label=nothing, - xlabel="Obstimes", - ylabel="Conc. of Pathogen Genome in WW", - title="Plot of Conc. of Pathogen Genome in WW Over Time") -``` - -### 2.1.2. Hospitalizations. -```@example tutorial -plot(df.obstimes, df.hosp, - label=nothing, - xlabel="Obstimes", - ylabel="Hosp", - title="Plot of Hosp Over Time") -``` - -### 2.1.3. Reproductive number. -```@example tutorial -plot(df.obstimes, df.rt, - label=nothing, - xlabel="Obstimes", - ylabel="RT", - title="Plot of RT Over Time") -``` - -## 3. Generating simulated data with an agent based model. - -This package provides a way to also simulate data using the agent based model in the future paper. The function called `generate_simulation_data_agent.jl` can be used to generate synthetic data for a given population size and features. Here we provide a demonstration using the default settings of `generate_simulation_data_agent.jl` : - -``` @example tutorial -using UCIWWEIHR -using Plots -# Running simulation function with defaults -df = generate_simulation_data_agent() -first(df, 5) -``` - -### 3.1. Visualizing SEIHR compartments. - -We can also use the [Plots.jl](https://github.com/JuliaPlots/Plots.jl) package to visualize the data generated. - -```@example tutorial -plot(df.Time, df.S, label = "Suseptible", xlabel = "Time", ylabel = "Number of Individuals", title = "Agent Based Model Simulation Results") -plot!(df.Time, df.E, label = "Exposed") -plot!(df.Time, df.I, label = "Infected") -plot!(df.Time, df.H, label = "Hospitalized") -plot!(df.Time, df.R, label = "Recovered") -``` diff --git a/docs/src/tutorial_index.md b/docs/src/tutorial_index.md new file mode 100644 index 0000000..79df2c9 --- /dev/null +++ b/docs/src/tutorial_index.md @@ -0,0 +1,11 @@ +# [Tutorial Contents](@id tutorial_home) + +Future Description. + +## Contents + +- [Getting Started](@ref getting_started) +- [Generating simulated data with UCIWWEIHR ODE compartmental based model.](@ref uciwweihr_simulation_data) +- [Generating simulated data with an agent based model.](@ref agent_based_simulation_data) + + diff --git a/docs/src/tutorials/agent_based_simulation_data.md b/docs/src/tutorials/agent_based_simulation_data.md new file mode 100644 index 0000000..634f34f --- /dev/null +++ b/docs/src/tutorials/agent_based_simulation_data.md @@ -0,0 +1,32 @@ +# [Generating simulated data with an agent based model.](@id agent_based_simulation_data) + +This package provides a way to also simulate data using the agent based model in the future paper. The function called `generate_simulation_data_agent.jl` can be used to generate synthetic data for a given population size and features. Here we provide a demonstration using the default settings of `generate_simulation_data_agent.jl` : + + +## 1. Functionality. + +``` @example tutorial +using UCIWWEIHR +using Plots +# Running simulation function with defaults +df = generate_simulation_data_agent() +first(df, 5) +``` + +## 2. Visualizing SEIHR compartments. + +We can also use the [TidierPlots](https://tidierorg.github.io/TidierPlots.jl/stable/) package to visualize the data generated. + +```@example tutorial +plot(df.Time, df.S, label = "Suseptible", + xlabel = "Time", + ylabel = "Number of Individuals", + title = "Agent Based Model Simulation Results") +plot!(df.Time, df.E, label = "Exposed") +plot!(df.Time, df.I, label = "Infected") +plot!(df.Time, df.H, label = "Hospitalized") +plot!(df.Time, df.R, label = "Recovered") +``` + + +### [Tutorial Contents](@ref tutorial_home) \ No newline at end of file diff --git a/docs/src/tutorials/getting_started.md b/docs/src/tutorials/getting_started.md new file mode 100644 index 0000000..2767d93 --- /dev/null +++ b/docs/src/tutorials/getting_started.md @@ -0,0 +1,15 @@ +# [Getting Started](@id getting_started) + +Welcome to the Tutorials page for the UCIWWEIHR.jl project. This section provides step-by-step guides and examples to help you get started with using the package and understanding its features. + +## 1. Installation. + +To install the UCIWWEIHR.jl package, open the Julia REPL and run the following command: + +``` julia +using Pkg +Pkg.add("UCIWWEIHR") +``` + + +### [Tutorial Contents](@ref tutorial_home) \ No newline at end of file diff --git a/docs/src/tutorials/uciwweihr_simulation_data.md b/docs/src/tutorials/uciwweihr_simulation_data.md new file mode 100644 index 0000000..989e94a --- /dev/null +++ b/docs/src/tutorials/uciwweihr_simulation_data.md @@ -0,0 +1,47 @@ +# [Generating simulated data with UCIWWEIHR ODE compartmental based model.](@id uciwweihr_simulation_data) + +This package provides a way to also simulate data using the UCIWWEIHR ODE compartmental based model specified in the future paper. The function called `generate_simulation_data_uciwweihr.jl` can be used to generate synthetic data for a given number of samples and features. Here we provide a demonstration using the default settings of `generate_simulation_data_uciwweihr.jl` : + +## 1. Functionality. + +``` @example tutorial +using UCIWWEIHR +using Plots +# Running simulation function with defaults +df = generate_simulation_data_uciwweihr() +first(df, 5) +``` + +## 2. Visualizing UCIWWEIHR model results. + +Here we can make simple plots to visualize the data generated using the [TidierPlots](https://tidierorg.github.io/TidierPlots.jl/stable/) package. + +### 2.1. Concentration of pathogen genome in wastewater(WW). +```@example tutorial +plot(df.obstimes, df.log_ww_conc, + label=nothing, + xlabel="Obstimes", + ylabel="Conc. of Pathogen Genome in WW", + title="Plot of Conc. of Pathogen Genome in WW Over Time") +``` + +### 2.2. Hospitalizations. +```@example tutorial +plot(df.obstimes, df.hosp, + label=nothing, + xlabel="Obstimes", + ylabel="Hosp", + title="Plot of Hosp Over Time") +``` + +### 2.3. Reproductive number. +```@example tutorial +plot(df.obstimes, df.rt, + label=nothing, + xlabel="Obstimes", + ylabel="Rt", + title="Plot of Rt Over Time") +``` + + +### [Tutorial Contents](@ref tutorial_home) \ No newline at end of file diff --git a/src/UCIWWEIHR.jl b/src/UCIWWEIHR.jl index 3bf48b1..d4485ed 100644 --- a/src/UCIWWEIHR.jl +++ b/src/UCIWWEIHR.jl @@ -17,7 +17,8 @@ using Logging using CSV using DataFrames using DifferentialEquations -using Plots +using Tidier +using TidierPlots using StatsBase include("generate_simulation_data_uciwweihr.jl") diff --git a/src/generate_simulation_data_agent.jl b/src/generate_simulation_data_agent.jl index d85705d..4c5c1cd 100644 --- a/src/generate_simulation_data_agent.jl +++ b/src/generate_simulation_data_agent.jl @@ -11,7 +11,7 @@ NOT FINISHED, STILL NEEDS WW AND RT - pop_size::Int64: Size of the population. Default value is 1000. - I_init::Int64: Initial number of infected individuals. Default value is 200. - H_init::Int64: Initial number of hospitalized individuals. Default value is 20. -- beta::Float64: Transmission rate. Default value is 0.2. +- beta::Float64: Transmission rate. Default value is 0.001. - gamma::Float64: Rate of exposed individuals becoming infectious. Default value is 1/4. - nu::Float64: Rate of infected individuals recovering or getting hospitalized. Default value is 1/7. - epsilon::Float64: Rate of hospitalized individuals recovering. Default value is 1/5. @@ -23,7 +23,7 @@ NOT FINISHED, STILL NEEDS WW AND RT function generate_simulation_data_agent( seed::Int64=1, pop_size::Int64=1000, I_init::Int64=200, H_init::Int64=20, - beta::Float64=0.2, gamma::Float64=1/4, + beta::Float64=0.001, gamma::Float64=1/4, nu::Float64=1/7, epsilon::Float64=1/5, w_init::Float64=0.35 ) diff --git a/test/runtests.jl b/test/runtests.jl index 509dade..a89072e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,8 +3,5 @@ using Test @testset "UCIWWEIHR.jl" begin # Write your tests here. - x = 2 - y = 2 - @test UCIWWEIHR.sum_values(x,y) == 4 end