Shortcut for initialisation of data's object model from a observe or a AVDTH database.

data_model_initialisation(
  data_source = "observe_database",
  database_connection,
  log_file = FALSE,
  log_path = NULL,
  log_name = "data_model_initialisation",
  years_period,
  flag_codes,
  ocean_codes,
  vessel_type_codes,
  species_fate_codes,
  sample_type_codes,
  trip_ids = NULL
)

Arguments

data_source

Object of class character expected. Identification of data source. By default "observe_database" but you can switch to "avdth_database".

database_connection

Database connection, list of one or more R object(s) expected. By default NULL. Mandatory argument for data source "observe_database" ("PostgreSQLConnection" R object), corresponding to the second element of the object returned by `furdeb::postgresql_dbconnection()`. Or mandatory argument for data source"avdth_database" ("JDBCConnection" R object) corresponding to the second element of the object returned by `furdeb::access_dbconnection()`. For data source "observe_database", a list of "PostgreSQLConnection" R objects can be specified to query data from different observe databases. For example, a list of two database connection arguments for "observe_main" and "observe_acquisition" can be specified to simultaneously import and process recent data from acquisition database, which has not yet been imported into the main database, and older data from the main database.

log_file

Object of class logical expected. By default FALSE. Initiation or not for log file creation.

log_path

Object of class character expected. By default NULL. Path of the log file directory.

log_name

Object of class character expected. By default "data_model_initialisation". Name of the log file.

years_period

Object of class integer expected. By default NULL. Year(s) of the reference time period coded on 4 digits. Mandatory for data source "observe_database" and "avdth_database".

flag_codes

Object of class character expected. By default NULL. Three letters country(ies) FAO code(s) related to data extraction. Necessary argument for data source "observe_database" and "avdth_database".

ocean_codes

Object of class integer expected. By default NULL. Ocean(s) related to data coded on 1 digit. Necessary argument for data source "observe_database" and "avdth_database".

vessel_type_codes

Object of class integer expected. By default NULL. Vessel type(s) related to data extraction. Necessary argument for data source "observe_database" and "avdth_database".

species_fate_codes

Object of class integer expected. By default NULL. Specie fate(s) related to data extraction. Necessary argument for data source "observe_database" and "avdth_database".

sample_type_codes

Object of class integer expected. By default NULL. Sample type identification.

trip_ids

Object of class character expected. By default NULL. Additional parameter only used with data source "observe_database". Use trip(s) identification(s) for selected trip(s) kept in the query. This argument overrides all others arguments like "years_period", "country" or "ocean".

Value

The function return a list with two R6 reference object inside: one class "object_model_data" and the second class "object_full_trips".