Skip to content

Commit

Permalink
Merge pull request #95 from NorwegianVeterinaryInstitute/dev
Browse files Browse the repository at this point in the history
NVIdb v0.13.0
  • Loading branch information
PetterHopp authored Dec 13, 2024
2 parents ede9938 + e47f520 commit d096019
Show file tree
Hide file tree
Showing 145 changed files with 5,065 additions and 5,184 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
^nosync$
^man-roxygen$
^CONTRIBUTING.md
^LICENSE.md
^README\.md
^README\.Rmd
^NVIdb.Rcheck\vign_test$
Expand Down
18 changes: 8 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: NVIdb
Title: Tools to facilitate the use of NVI's databases
Version: 0.12.0
Date: 2024-05-22
Version: 0.13.0
Date: 2024-12-13
Authors@R:
c(person(given = "Petter",
family = "Hopp",
Expand All @@ -14,18 +14,17 @@ Authors@R:
person(given = "Norwegian Veterinary Institute",
role = "cph"))
Description: Provides tools to facilitate downloading and processing of data from
the Norwegian Veterinary Institute's databases, in particular PJS and EOS. The
package comprises several categories of functions:
the Norwegian Veterinary Institute's databases. The package comprises several
categories of functions.
1) Manage credentials (i.e. password and username),
2) Login functions for database services,
3) Select PJS-data,
4) Initial cleaning of PJS-data,
5) Read, copy and update various in-house data registers,
6) Translate codes into descriptions.
3) Read, copy and update various in-house data registers,
4) Translate codes into descriptions.
NVIdb is dependant of NVIconfig which has to be installed manually from GitHub.
All PJS and EOS related functions are moved to NVIpjsr.
URL: https://github.com/NorwegianVeterinaryInstitute/NVIdb
BugReports: https://github.com/NorwegianVeterinaryInstitute/NVIdb/issues
Depends: R (>= 3.5.0)
Depends: R (>= 4.1.0)
License: BSD_3_clause + file LICENSE
Imports:
askpass,
Expand All @@ -34,7 +33,6 @@ Imports:
DBI,
dplyr,
keyring,
magrittr,
odbc,
RODBC,
RPostgreSQL,
Expand Down
32 changes: 3 additions & 29 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
BSD 3-Clause License

Copyright (c) 2021 - 2024 Norwegian Veterinary Institute
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
YEAR: 2019 - 2024
COPYRIGHT HOLDER: Norwegian Veterinary Institute
ORGANIZATION: Norwegian Veterinary Institute
29 changes: 29 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2019 - 2024 Norwegian Veterinary Institute
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(add_MT_omrader)
export(add_PJS_code_description)
export(add_kommune_fylke)
Expand Down Expand Up @@ -61,4 +60,3 @@ export(standardize_PJSdata)
export(standardize_columns)
export(standardize_eos_data)
export(transform_code_combinations)
importFrom(magrittr,"%>%")
23 changes: 22 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# NVIdb 0.13.0 - (2024-12-13)

## Bug fixes:

- Fixed `login_by_input` for log in when using `dbinterface = "RPostgreSQL"`.


## Other changes:

- Included a meaningful error message for `read_Prodtilskudd` if no versions of Produksjonstilskudd was available for the selected years and months.

- Improved help by standardising parameter description for functions.

- Changed pipe to internal pipe |> and updated dependencies to R 4.1.0.


## BREAKING CHANGES:

- Deprecated all functions that have been moved to NVIpjsr, i.e. `add_PJS_code_description`, `build_query_hensikt`, `build_query_one_disease`, `build_query_outbreak`, `build_sql_select_code`, `build_sql_select_year`, `choose_PJS_levels`, `copy_PJS_code_2_text`, `exclude_from_PJSdata`, `login_by_credentials_PJS`, `read_eos_data`, `read_PJS_code_2_text`, `retrieve_PJSdata`, `select_PJSdata_for_value`, `set_disease_parameters`, `standardize_eos_data`, `standardize_PJSdata`, `transform_code_combinations`.


# NVIdb 0.12.0 - (2024-05-22)

## New features:

- Added argument `year` to `add_kommune_fylke`. Kommune and fylke can now be translated to any year from 1077 to current year from previous years. It is not possible to translate from a later year to previous years.
- Added argument `year` to `add_kommune_fylke`. Kommune and fylke can now be translated to any year from 1977 to current year from previous years. It is not possible to translate from a later year to previous years.


# NVIdb 0.11.3 - (2024-05-03)
Expand Down
44 changes: 44 additions & 0 deletions R/NVIdb-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@
#' using the old arguments, the input will be transferred to
#' \code{selection_parameters}.
#'
#' All functions made especially to handle PJS data have been moved to \code{NVIpjsr}
#' and were deprecated from v0.##.# released 2024-##-##. Further development
#' of these functions will only take place in \code{NVIpjsr}. The following
#' functions have been moved:
#' \itemize{
#' \item \code{add_PJS_code_description}
#' \item \code{build_query_hensikt}
#' \item \code{build_query_one_disease}
#' \item \code{build_query_outbreak}
#' \item \code{build_sql_select_code}
#' \item \code{build_sql_select_year}
#' \item \code{choose_PJS_levels}
#' \item \code{copy_PJS_code_2_text}
#' \item \code{exclude_from_PJSdata}
#' \item \code{login_by_credentials_PJS}
#' \item \code{read_eos_data}
#' \item \code{read_PJS_code_2_text}
#' \item \code{retrieve_PJSdata}
#' \item \code{select_PJSdata_for_value}
#' \item \code{set_disease_parameters}
#' \item \code{standardize_eos_data}
#' \item \code{standardize_PJSdata}
#' \item \code{transform_code_combinations}
#' }
#'
#' @param \dots (arguments)
#' @return (results)
#' @name NVIdb-deprecated
Expand All @@ -56,5 +81,24 @@
#' login_by_input_EOS(...) ### -- use login_by_input("EOS") instead.
#' login_by_credentials_EOS(...) ### -- use login_by_credentials("EOS") instead.
#' set_credentials_EOS(...) ### -- use set_credentials("EOS") instead.
#' login_by_credentials_PJS(...) ### -- use login_by_credentials("PJS") instead
#' add_PJS_code_description(...) ### -- use NVIpjsr::add_PJS_code_description() instead
#' build_query_hensikt(...) ### -- use NVIpjsr::build_query_hensikt() instead
#' build_query_one_disease(...) ### -- use NVIpjsr:build_query_one_disease:() instead
#' build_query_outbreak(...) ### -- use NVIpjsr::build_query_outbreak() instead
#' build_sql_select_code(...) ### -- use NVIpjsr::build_sql_select_code() instead
#' build_sql_select_year(...) ### -- use NVIpjsr::build_sql_select_year() instead
#' choose_PJS_levels(...) ### -- use NVIpjsr::choose_PJS_levels() instead
#' copy_PJS_code_2_text(...) ### -- use NVIpjsr::copy_PJS_code_2_text() instead
#' exclude_from_PJSdata(...) ### -- use NVIpjsr::exclude_from_PJSdata() instead
#' login_by_credentials_PJS(...) ### -- use login_by_credentials("PJS") instead
#' read_eos_data(...) ### -- use NVIpjsr::read_eos_data() instead
#' read_PJS_code_2_text(...) ### -- use NVIpjsr::read_PJS_code_2_text() instead
#' retrieve_PJSdata(...) ### -- use NVIpjsr::retrieve_PJSdata() instead
#' select_PJSdata_for_value(...) ### -- use NVIpjsr::select_PJSdata_for_value() instead
#' set_disease_parameters(...) ### -- use NVIpjsr::set_disease_parameters() instead
#' standardize_eos_data(...) ### -- use NVIpjsr::standardize_eos_data() instead
#' standardize_PJSdata(...) ### -- use NVIpjsr::standardize_PJSdata() instead
#' transform_code_combinations(...) ### -- use NVIpjsr::transform_code_combinations() instead
#' }
NULL
31 changes: 19 additions & 12 deletions R/add_MT_omrader.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,29 @@
#' available for \code{read_MT_omrader} if they should be read from
#' another directory.
#'
#' @param data Data frame with data with a column with a komnr.
#' @param translation_table Data frame with the table for translating from
#' komnr to MT_areas.
#' @param code_column The column with the coded value. Valid values are one
#' @param data [\code{data.frame}]\cr
#' Data with a column with kommunenummer (komnr).
#' @param translation_table [\code{data.frame}]\cr
#' The translation table for translating komnr to MT-areas. Defaults
#' to \code{komnr_2_MT_omrader}.
#' @param code_column [\code{character(1)}]\cr
#' The column with the code value. Valid values are one
#' of c("komnr", "MT_avdelingnr", "MT_regionnr"). If the column in data
#' has another name, it can be input as a named vector, see examples.
#' @param new_column The new columns that should be included into the data
#' frame. The new columns can be up to c("MT_avdelingnr", "MT_avdeling",
#' "MT_regionnr", "MT_region") depending on \code{code_column}.
#' If the new columns in the result data frame should have other names,
#' \code{new_column} can be input as a named vector, see examples.
#' Defaults to "komnr".
#' @param new_column [\code{character}]\cr
#' The name(s) of the new column(s) that should be added to the data,
#' see examples. Defaults to c("MT_avdelingnr", "MT_avdeling",
#' "MT_regionnr", "MT_region").
#' @template position
#' @template overwrite
#' @param filename a list with the filenames of the source files with the tables for generating the translation table.
#' @param from_path Path for the source files for the translation table.
#' @param to_path Path to where the source files for the translation table should be copied.
#' @param filename [\code{list}]\cr
#' File names of the source files for the translation table. Defaults to
#' list("komnr_2_MT_avdeling.csv", "MT_omrader.csv").
#' @template from_path_add
#' @template to_path_add
#' @param \dots Other arguments to be passed to
#' \ifelse{html}{\code{\link[utils:read.csv2]{utils::read.csv2}}}{\code{utils::read.csv2}}.
#'
#' @return \code{add_MT_omrader} A data frame where the MT_avdelingnr has been added in the column to the
#' right of the column with the komnr.
Expand Down
Loading

0 comments on commit d096019

Please sign in to comment.