load_datasets_in_db: Load a dataset in Sardara database

load_datasets_in_dbR Documentation

Load a dataset in Sardara database

Description

These functions enable to load a dataset in Sardara database. The datasets can be of type "raw_dataset", "df_input" or "mapping"

Usage

load_raw_dataset_in_db(con,df_to_load,df_metadata,df_codelists_input)
load_codelist_in_db(con,df_to_load,df_metadata)
load_mapping_in_db(con,df_to_load,df_metadata)

Arguments

con

a wrapper of rpostgresql connection (connection to a database) with WRITE permission

df_to_load

data.frame to load. See section "Details" for the structure of the dataset

df_metadata

data.frame of metadata of to the df_to_load. See section "Details" for the structure of the dataset

df_codelists_input

data.frame of the code lists used in case of loading of a raw_dataset. See section "Details" for the structure of the dataset

Details

The input data.frames (parameters df_to_load) must comply with defined structures.

For raw datasets: A REDIGER

For code lists:

  • 1 column named 'code': containing the unique and not null codes for the code list

  • 1 column named 'label': associated label.

  • Any additional column is accepted.

  • For spatial code lists, they must have a column named "geom_wkt" with the geometry in WKT format. If geometries are missing, the colum must be filled-in with value NA

For code lists mappings:

  • 1 column named 'src_code': code of the code list source (code to map)

  • 1 column named 'trg_code': code of the code list target

  • 1 column named 'src_codingsystem': name (dataset_name) of the coding system in Sardara from where the code source is extracted. Only 1 value authorized. The code list must be in the database.

  • 1 column named 'trg_codingsystem': name (dataset_name) of the coding system in Sardara from where the code target is extracted. The code list must be in the database.

In addition, The code lists used in the mapping must be available in the DB.

For df_codelists_input: a template is available under inst/extdata/template_df_code_list.csv

For df_metadata: a template of the metadata data.frame to use is available under inst/extdata/template_metadata.csv

Author(s)

Paul Taconet, paul.taconet@ird.fr


ptaconet/rtunaatlas documentation built on June 23, 2024, 9:35 p.m.