diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..40154c8 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,545 @@ +# MIT License + +Copyright (c) 2022 mpx-diagnosis authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +-- + +# Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. + +--- + +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + + diff --git a/README.Rmd b/README.Rmd index 1078578..625f522 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,19 +13,47 @@ knitr::opts_chunk$set( ) ``` -# Containerised R workflow template +# An open-source framework for Rift Valley Fever forecasting [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) -[![container-workflow-template](https://github.com/ecohealthalliance/container-template/actions/workflows/container-workflow-template.yml/badge.svg)](https://github.com/ecohealthalliance/container-template/actions/workflows/container-workflow-template.yml) +[![License (for code): MIT](https://img.shields.io/badge/License (for code)-MIT-green.svg)](https://opensource.org/licenses/MIT) +[![License: CC0-1.0](https://img.shields.io/badge/License (for data)-CC0_1.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/) +[![License: CC-BY-4.0](https://img.shields.io/badge/License (for text)-CC_BY_4.0-blue.svg)](http://creativecommons.org/publicdomain/zero/1.0/) -This is a template repository of a containerised R workflow built on the `targets` framework, made portable using `renv`, and ran manually or automatically using `GitHub Actions`. To use this template click on the "use this template button" and then select create a new repository. - -Check out the [`containerTemplateUtils`](https://github.com/ecohealthalliance/containerTemplateUtils) package for handling common tasks related to this repo (sending emails, uploading files to AWS, etc. ) +### OpenRVFcast +EcoHealth Alliance's ongoing OpenRVFcast project is developing a generalizable, open-source modeling framework for predicting Rift Valley Fever (RVF) outbreaks in Africa, funded by the Wellcome Trust's climate-sensitive infectious disease [modeling initiative](https://wellcome.org/news/digital-tools-climate-sensitive-infectious-disease). We aim to integrate open data sets of climatic and vegetation data with internationally-reported outbreak data to build an modeling pipeline that can be adapted to varying local conditions in RVF-prone regions across the continent. + +### Repository Structure and Reproducibility +- `data/` contains downloaded and transformed data sources. These data are .gitignored and non-EHA users will need to download the data. +- `R/` contains functions used in this analysis. +- `reports/` contains literate code for R Markdown reports generated in the analysis +- `outputs/` contains compiled reports and figures. +- This project uses the [{renv}](https://rstudio.github.io/renv/) framework to + record R package dependencies and versions. Packages and versions used are recorded in `renv.lock` and code used to manage dependencies is in `renv/` and other files in the root project directory. On starting an R session in the working directory, run `renv::restore()` to install R package dependencies. +- This project uses the [{targets}](https://wlandau.github.io/targets-manual/) + framework to organize build steps for analysis pipeline. The schematic figure below summarizes the steps. (The figure is generated using `mermaid.js` syntax and should display as a graph on GitHub. It can also be viewed by pasting the code into .) + + +```{r, echo=FALSE, message = FALSE, results='asis'} +mer <- targets::tar_mermaid(targets_only = TRUE, outdated = FALSE, + legend = FALSE, color = FALSE, + exclude = c("readme", ends_with("_targets"))) +cat( + "```mermaid", + mer[1], + #'Objects([""Objects""]) --- Functions>""Functions""]', + 'subgraph Project Workflow', + mer[3:length(mer)], + 'linkStyle 0 stroke-width:0px;', + "```", + sep = "\n" +) +``` -Note that `git-crypt` is not part of the template repo. See the [EHA M&A handbook](https://ecohealthalliance.github.io/eha-ma-handbook/16-encryption.html#set-up-encryption-for-a-repo-that-did-not-previously-use-git-crypt) for how to add git-crypt. +To run the pipeline, the user will need to adapt the `_targets.R` file to use their own object storage repository (we use AWS) and will need to supply keys in an `.env` file. Follow the links for more information about: @@ -34,232 +62,3 @@ Follow the links for more information about: - [git-crypt](https://ecohealthalliance.github.io/eha-ma-handbook/16-encryption.html) - [Reproducible workflows](https://github.com/ecohealthalliance/building-blocks-of-reproducibility) -Recommendations: -- One function per file in R/ -- Non-function R scripts in another directory like `scripts/` -- Use the same names for targets and function arguments for those targets unless a function -- Nouns for targets, verbs for functions -- Use common suffixes for target types: `_file` for files, `_raw` for read-in but unprocessed data -- Use `fnmate` and `tflow` RStudio Add-Ins to make this easy, create shortcuts for these add-ins ([talk](https://www.youtube.com/watch?v=jU1Zv21GvT4)), or the `usethis` package - -## Quick start - -- Create repo from template -- rename .Rproj file -- streamline packages in `packages.R` -- modify `.gitattributes` to include any files that may need encryption -- initialize `git-crypt` for repo -- add relevant environment variables to `.env` file -- rename github actions workflows - -## GitHub Actions - -[GitHub Actions](https://docs.github.com/en/actions) allows automation, customisation, and execution of your research project workflows right in your GitHub repository. - -In gist, [GitHub Actions](https://docs.github.com/en/actions) is a *workflow* composed of a *job* or a number of *jobs*. The *job/s* are then composed of *steps* that control the order in which *actions* are run in order to complete a *job/s*. This *workflow* is scheduled or triggered by a specific *event* and runs on what is called a *runner* - a server that has the [GitHub Actions](https://docs.github.com/en/actions) runner application installed - that is either hosted by GitHub, or self-hosted on your own machines. - -This whole **workflow** including the **event** trigger and the **runner** on which the **workflow** will run in are specified and detailed using a workflow `.yml` file that is saved inside a directory named `.github` within your GitHub repository in which you want to use [GitHub Actions](https://docs.github.com/en/actions) on. - - - -This repository, contains a template [GitHub Actions](https://docs.github.com/en/actions) workflow with its corresponding `.yml` file that illustrates how [GitHub Actions](https://docs.github.com/en/actions) can be used to run and maintain an R workflow that uses `targets` and `renv`. - -## Using containers in GitHub Actions workflow - -A **container** is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. - -**Containers** can be used within a [GitHub Actions](https://docs.github.com/en/actions) workflow and can be specified either at the **job** level or at the **step** level. If specified at the **job** level, all the **steps** within that **job** will be run inside that container. When specified at the **steps** level, different containers can be used for each **step**. - -The example/template workflow can be found inside the `.github` folder and is shown below: - -```yaml -name: container-workflow-template - -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - workflow_dispatch: - branches: - - '*' - #schedule: - # - cron: "0 8 * * *" - -jobs: - container-workflow-tempalte: - runs-on: ubuntu-latest # Run on GitHub Actions runner - #runs-on: [self-hosted, linux, x64, onprem-aegypti] # Run the workflow on EHA aegypti runner - #runs-on: [self-hosted, linux, x64, onprem-prospero] # Run the workflow on EHA prospero runner - container: - image: rocker/verse:4.1.2 - - steps: - - uses: actions/checkout@v2 - - - name: Install system dependencies - run: | - apt-get update && apt-get install -y --no-install-recommends \ - libcurl4-openssl-dev \ - libssl-dev - - - name: Restore R packages - run: | - renv::restore() - shell: Rscript {0} - - - name: Run targets workflow - run: | - targets::tar_make() - shell: Rscript {0} -``` - -In this example, we show a data quality check workflow report for a nutrition survey of children 6-59 months old. - -### The trigger - -The trigger for GitHub Actions is specified in these lines in the workflow YAML file: - -```yaml -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - workflow_dispatch: - branches: - - '*' - #schedule: - # - cron: "0 8 * * *" -``` - -This workflow automatically runs when there is a **push** or **pull request** event to the main branch of the repository. This workflow has also been set to have the option to be run manually from the GitHub Actions page for any branch of the repository through the `workflow-dispatch` specification in the workflow YAML file. - -GitHub Actions can also be scheduled to run at specific times and frequency using the `schedule` specification in the workflow YAML file using [POSIX cron syntax](https://en.wikipedia.org/wiki/Cron). Scheduled workflows run on the latest commit on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes. In the example workflow, the `schedule` specification has been set to run at 8 am everyday but this has been hashed out. If you would like to schedule your workflow runs, remove the hash and then set the POSIX cron syntax to the frequency that you require. *Note while github actions is highly reliable Github does not guarantee that a scheduled job will run if you're using github servers and jobs are less likely to run if you choose a popular run time (generally on the hour).* - -### The job - -The job for GitHub Actions is specified in these lines in the workflow YAML file: - -```yaml -jobs: - container-workflow-template: - runs-on: ubuntu-latest # Run on GitHub Actions runner - #runs-on: [self-hosted, linux, x64, onprem-aegypti] # Run the workflow on EHA aegypti runner - #runs-on: [self-hosted, linux, x64, onprem-prospero] # Run the workflow on EHA prospero runner - container: - image: rocker/verse:4.1.2 -``` - -The job named `container-workflow-template` is specified to run on runners hosted by GitHub Actions. These runners can be identified through a tag that specifies the operating software followed by the version. In the example workflow, the line specifying `runs-on: ubuntu-latest` runs the workflow on a machine hosted by GitHub Actions with the latest Ubuntu operating software. - -The job can also be run on a self-hosted GitHub Actions runner that is installed on EHA's high performance computing machines using the `runs-on` workflow YAML specification. Tags unique to this GitHub runner are used to identify the specific machine to use. Syntax on how to specify these runners are shown but hashed out. - -To further make the GitHub Actions workflow more robust and reproducible, we setup a container at the **job** level. The container specified is a versioned R image that has `tidyverse` and other R publishing tools installed. This container image would generally be adequate for most workflows that require data wrangling and manipulation using the `tidyverse` tools and reporting using `rmarkdown`. Some projects/workflows (like those using spatial packages such as `sf`) may benefit from using a different R image so change the container specification accordingly. To read more about available R images, see https://www.rocker-project.org/images/. - - -## Using this GitHub Actions workflow template - -This repository has been set as a private template repository. This means that this can be used by EHA staff for creating new repositories with the same filesystem. - -This can be done as follows: - -1. In your GitHub account, go to the EcoHealth Alliance organisation (https://github.com/ecohealthalliance) then click on the green button labeled `New`. - -2. You will now be directed to the `Create new repository` page. Here, right at the top, you will see the `Repository template` heading. Click on the drop down button right below this that says `No template`. You will then see all the available templates within EHA. Select the template named `ecohealthalliance/container-template`. - -3. Give your new repository a name, set the appropriate repository visibility, and then click on `Create repository`. - -4. You will now have a new repository the contents of which are the same files and structure as this template repository. - -5. You can now make the necessary changes and additions that are specific to your workflow. - -## Using `git-crypt` to encrypt files in your workflow - -Your project may contain a mix of public and private content. Being able to encrypt the private contents of your project is very useful. It is recommended that you use PGP (Pretty Good Privacy) encryption, implemented by the program [`git-crypt`](https://github.com/AGWA/git-crypt). It takes a bit to set up but once activated makes sharing secure and seamless. To setup PGP and `git-crypt` on your project that is based on this template, see the [*Encryption* chapter of the EHA Modeling and Analytics Handbook](https://ecohealthalliance.github.io/eha-ma-handbook/14-encryption.html). - -Once you have enabled `git-crypt` on your project, you will need to make the following edits to the `container-workflow-template.yml` file to be able to perform symmetric key decryption described [here](https://ecohealthalliance.github.io/eha-ma-handbook/14-encryption.html#extra-use-a-symmetric-key-for-automated-processes). Here is the `container-workflow-template.yml` file updated to allow and perform symmetric key decryption: - -```yaml -name: container-workflow-encrypted-template - -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - workflow_dispatch: - branches: - - '*' - #schedule: - # - cron: "0 8 * * *" - -env: - GIT_CRYPT_KEY64: ${{ secrets.GIT_CRYPT_KEY64 }} - -jobs: - container-workflow-encrypted-tempalte: - runs-on: ubuntu-latest # Run on GitHub Actions runner - #runs-on: [self-hosted, linux, x64, onprem-aegypti] # Run the workflow on EHA aegypti runner - #runs-on: [self-hosted, linux, x64, onprem-prospero] # Run the workflow on EHA prospero runner - container: - image: rocker/verse:4.1.2 - - steps: - - uses: actions/checkout@v2 - - - name: Install system dependencies - run: | - apt-get update && apt-get install -y --no-install-recommends \ - git-crypt \ - libcurl4-openssl-dev \ - libssl-dev - - - name: Decrypt repository using symmetric key - run: | - echo $GIT_CRYPT_KEY64 > git_crypt_key.key64 && base64 -di git_crypt_key.key64 > git_crypt_key.key && git-crypt unlock git_crypt_key.key - rm git_crypt_key.key git_crypt_key.key64 - - - name: Restore R packages - run: | - renv::restore() - shell: Rscript {0} - - - name: Run targets workflow - run: | - targets::tar_make() - shell: Rscript {0} -``` - -Once you have edited your worklfow YAML file and before you push the changes to GitHub, you will then have to add the symmetric key to your GitHub repository as a secret. - -First, generate a symmetric key by running this in your project directory. - -```bash -git-crypt export-key git_crypt_key.key -``` - -`git_crypt_key.key` can now be used to decrypt the repository, and you can provide it to GitHub Actions as a secret environment variable (see https://docs.github.com/en/actions/security-guides/encrypted-secrets). However, since it is binary data, you’ll need to convert it to base64 first. So run something like: - -```bash -cat git_crypt_key.key | base64 | pbcopy -``` - -to convert this file to base64 data, then paste it in GitHub’s secret environment variable field as `GIT_CRYPT_KEY64`. - - - - - diff --git a/README.md b/README.md index def0152..a90a2e5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# Open RVFcast +# An open-source framework for Rift Valley Fever forecasting @@ -10,11 +10,90 @@ has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) +[![License (for code): +MIT](https://img.shields.io/badge/License%20(for%20code)-MIT-green.svg)](https://opensource.org/licenses/MIT) +[![License: +CC0-1.0](https://img.shields.io/badge/License%20(for%20data)-CC0_1.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/) +[![License: +CC-BY-4.0](https://img.shields.io/badge/License%20(for%20text)-CC_BY_4.0-blue.svg)](http://creativecommons.org/publicdomain/zero/1.0/) + +### OpenRVFcast -This repository is based on EHA's [template repository](https://github.com/ecohealthalliance/container-template) of a containerised R workflow built on the -`targets` framework, made portable using `renv`, and ran manually or -automatically using `GitHub Actions`. +EcoHealth Alliance’s ongoing OpenRVFcast project is developing a +generalizable, open-source modeling framework for predicting Rift Valley +Fever (RVF) outbreaks in Africa, funded by the Wellcome Trust’s +climate-sensitive infectious disease [modeling +initiative](https://wellcome.org/news/digital-tools-climate-sensitive-infectious-disease). +We aim to integrate open data sets of climatic and vegetation data with +internationally-reported outbreak data to build an modeling pipeline +that can be adapted to varying local conditions in RVF-prone regions +across the continent. + +### Repository Structure and Reproducibility + +- `data/` contains downloaded and transformed data sources. These data + are .gitignored and non-EHA users will need to download the data. +- `R/` contains functions used in this analysis. +- `reports/` contains literate code for R Markdown reports generated in + the analysis +- `outputs/` contains compiled reports and figures. +- This project uses the [{renv}](https://rstudio.github.io/renv/) + framework to record R package dependencies and versions. Packages and + versions used are recorded in `renv.lock` and code used to manage + dependencies is in `renv/` and other files in the root project + directory. On starting an R session in the working directory, run + `renv::restore()` to install R package dependencies. +- This project uses the + [{targets}](https://wlandau.github.io/targets-manual/) framework to + organize build steps for analysis pipeline. The schematic figure below + summarizes the steps. (The figure is generated using `mermaid.js` + syntax and should display as a graph on GitHub. It can also be viewed + by pasting the code into .) + +``` mermaid +graph LR +subgraph Project Workflow + direction LR + xcec9a7631fb026ee(["ecmwf_forecasts_directory"]):::skipped --> xa5738a057262b61d(["ecmwf_forecasts_upload_aws_s3"]):::skipped + x9c76f3c92ea2d49d["ecmwf_forecasts_downloaded"]:::skipped --> xa5738a057262b61d(["ecmwf_forecasts_upload_aws_s3"]):::skipped + xa1d97300a3b205ca(["continent_bounding_box"]):::skipped --> xbb3aa5bc7b1658be(["ecmwf_api_parameters"]):::skipped + x0ba8074843dd369a(["continent_polygon"]):::skipped --> x012d23f29668478a(["continent_raster_template_plot"]):::built + x2afa632571070318(["continent_raster_template"]):::built --> x012d23f29668478a(["continent_raster_template_plot"]):::built + x2afa632571070318(["continent_raster_template"]):::built --> x01658e026e0a29fd["sentinel_ndvi_transformed_rasters"]:::built + xfd232772a977e694(["sentinel_ndvi_directory"]):::skipped --> x01658e026e0a29fd["sentinel_ndvi_transformed_rasters"]:::built + x26dfd01796db7ec2["sentinel_ndvi_downloaded"]:::skipped --> x01658e026e0a29fd["sentinel_ndvi_transformed_rasters"]:::built + x0ba8074843dd369a(["continent_polygon"]):::skipped --> xa1d97300a3b205ca(["continent_bounding_box"]):::skipped + xfd232772a977e694(["sentinel_ndvi_directory"]):::skipped --> xe97089048cc40c8d(["sentinel_ndvi_upload_aws_s3"]):::built + x26dfd01796db7ec2["sentinel_ndvi_downloaded"]:::skipped --> xe97089048cc40c8d(["sentinel_ndvi_upload_aws_s3"]):::built + xcec9a7631fb026ee(["ecmwf_forecasts_directory"]):::skipped --> xff73ba0124e5a017["ecmwf_forecasts_flat_transformed"]:::built + x9c76f3c92ea2d49d["ecmwf_forecasts_downloaded"]:::skipped --> xff73ba0124e5a017["ecmwf_forecasts_flat_transformed"]:::built + xb038a30f0a35723c(["modis_ndvi_directory"]):::built --> x44ef5d48bcfaea21(["modis_ndvi_upload_aws_s3"]):::queued + x77ec1b9f60190564["modis_ndvi_downloaded"]:::queued --> x44ef5d48bcfaea21(["modis_ndvi_upload_aws_s3"]):::queued + xd854377155612be3(["wahis_rvf_outbreaks_raw"]):::built --> xeadd38ebf89ffb3e(["wahis_rvf_outbreaks_preprocessed"]):::built + x479365af91c7e266(["sentinel_ndvi_api_parameters"]):::skipped --> x26dfd01796db7ec2["sentinel_ndvi_downloaded"]:::skipped + xfd232772a977e694(["sentinel_ndvi_directory"]):::skipped --> x26dfd01796db7ec2["sentinel_ndvi_downloaded"]:::skipped + xbb3aa5bc7b1658be(["ecmwf_api_parameters"]):::skipped --> x9c76f3c92ea2d49d["ecmwf_forecasts_downloaded"]:::skipped + xcec9a7631fb026ee(["ecmwf_forecasts_directory"]):::skipped --> x9c76f3c92ea2d49d["ecmwf_forecasts_downloaded"]:::skipped + x0ba8074843dd369a(["continent_polygon"]):::skipped --> x2afa632571070318(["continent_raster_template"]):::built + xa1d97300a3b205ca(["continent_bounding_box"]):::skipped --> x77ec1b9f60190564["modis_ndvi_downloaded"]:::queued + xb038a30f0a35723c(["modis_ndvi_directory"]):::built --> x77ec1b9f60190564["modis_ndvi_downloaded"]:::queued + xa3da9b3925f9741f(["modis_ndvi_years"]):::built --> x77ec1b9f60190564["modis_ndvi_downloaded"]:::queued + xd52ee303d6021275(["country_polygons"]):::skipped --> x39dbcca303e23588(["country_bounding_boxes"]):::built + xf72c4ee15d2a0400(["nasa_weather_directory"]):::built --> xbfbce2d14bfd3f89(["nasa_weather_upload_aws_s3"]):::built + x43cae5645a1256a7["nasa_weather_downloaded"]:::skipped --> xbfbce2d14bfd3f89(["nasa_weather_upload_aws_s3"]):::built + x39dbcca303e23588(["country_bounding_boxes"]):::built --> xbe17c5133608677e(["nasa_weather_coordinates"]):::built + xbe17c5133608677e(["nasa_weather_coordinates"]):::built --> x43cae5645a1256a7["nasa_weather_downloaded"]:::skipped + xf72c4ee15d2a0400(["nasa_weather_directory"]):::built --> x43cae5645a1256a7["nasa_weather_downloaded"]:::skipped + x5f34aae31382da1e(["nasa_weather_variables"]):::built --> x43cae5645a1256a7["nasa_weather_downloaded"]:::skipped + x910c507cd106a733(["nasa_weather_years"]):::built --> x43cae5645a1256a7["nasa_weather_downloaded"]:::skipped + end +linkStyle 0 stroke-width:0px; +``` + +To run the pipeline, the user will need to adapt the `_targets.R` file +to use their own object storage repository (we use AWS) and will need to +supply keys in an `.env` file. Follow the links for more information about: