Skip to contents

Work in Progress

This package is still work in progress, but it is ready for testing! Please provide feedback on any issues, and check back regularly for updates.

Here we want to summarise discussions about the structure of the package, design decisions around functions, and their relationship with the cross-referencing process.

User journey

For the package design we distinguish two main stages of the cross-referencing process. The first is dedicated to data preparation, validation and exploration. The second is dedicated to analysis and synthesis. See Figure 1 for an overview.

flowchart TB
    PREP["Data Preparation:<br/>importing, joining, filtering, modifying datasets "]:::Mixed
    VALID{"Data<br/>Validation"}:::InPkg
    EXP[Exploration:<br/> Interpreters, rounds, membership values]:::InPkg
    NINT{"No. interpreters<br/> and rounds"}:::InPkg
    ELI1[Within rounds<br/>agreemnet]:::InPkg
    ELI2[Between rounds<br/>entropy metrics]:::InPkg

    FILTER["Between rounds<br/>entropy metrics"]:::InPkg
    SYNT[Synthesis]:::InPkg
    OUTP[Outputs]:::Mixed

    subgraph FIRST["Data preparation and exploration"]
        direction LR
        PREP --> VALID
        VALID -->|no| PREP
        VALID -->|yes| EXP -.->|review data if necessary| PREP
    end
    FIRST:::Steps --> SECOND:::Steps
    subgraph SECOND["Analysis"]
        direction LR
        NINT -->|"1 interpreter <br> round"| THIRD;
        NINT -->|"1 interpreter <br> >1 round"| FILTER -->|Filtering| THIRD ;
        NINT -->|">1 interpreter"| FOURTH:::Mixed -->|Filtering| THIRD:::Steps;
    end
    subgraph THIRD["Synthesis"]
        direction TB
        SYNT --> OUTP;
    end
    subgraph FOURTH["Expert elicitation"]
        direction TB
        ELI1 --> ELI2
    end
    classDef Data fill:#f8f9fa,stroke:#1A1A1A,color:#1A1A1A,stroke-width:2px
    classDef InPkg fill:#dfd,stroke:#040,color:#040,stroke-width:2px
    classDef Mixed fill:#fff,stroke:#853E90,color:#853E90,stroke-width:2px,stroke-dasharray:5 5
    classDef Steps fill:#fff,stroke:#853E90,color:#853E90,stroke-width:1px
Figure 1: Steps of the user journey. Solid green symbols can be completed with the package functions, classes and methods. Dashed symbols require a mix of package functions, other packages, and external tools.

The ecoSynthesis package aims to facilitate the tasks related to these stages of the cross-referencing process. While some task could be completed with the functions, classes and methods defined in this package, there are some task that will require interaction with additional R packages, other tools, and the real world.

Functions, classes and methods

This package includes functions, classes and methods. Some functionality has been proposed and tested outside the package development process. Some of these proposals are integrated in development branches before they are implemented in the main branch.

We use a consistent key to refer to these in all figures Figure 2.

membership cluster_inPkg Main branchcluster_WIP Development branchescluster_Prop ProposedCL This is my classwith a descriptionMT MethodFor(my class)CLWIP This is my classwith a descriptionMTWIP MethodFor(my class)FN function_name()with descriptionFNWIP function_name()with descriptionCLPROP This is my classwith a descriptionMTPROP MethodFor(my class)FNPROP function_name()with description
Figure 2: Visual key to functions, classes and methods in different stages of development.

Core functions

Two core functions (lookup_tbl() and membership_tbl()) create the main classes used in the package. All other functions will work with these two main classes.

Warning

Documentation of the classes is missing in the R files!

membership cluster_prep Core functionsMT Class membership_tbl(not documented)MTP print(membership_tbl)MT->MTP has methodLUT Class lookup_tbl(not documented)LUTP print(lookup_tbl)LUT->LUTP has methodLUTF lookup_tbl()Create a lookup tablefor a classificationLUTF->LUT createsMTF membership_tbl()Create a membership tableMTF->MT creates
Figure 3: Core functions (blue), classes (gold), methods (green) and their relationships.

Data preparation

We propose a couple of simple functions to facilitate the most common data import nad data cleaning steps.

TO DO

Two proposed functions membership_clean() and read_membership().

membership cluster_prep Data preparation cyclecluster_main Core functionsMT Class membership_tbl(not documented)CLEANMT clean_membership()Flag and remove errors from membership tableMT->CLEANMT inputLUT Class lookup_tbl(not documented)LUT->CLEANMT input(optional)LUTF lookup_tbl()Create a lookup tablefor a classificationLUTF->LUT createsMTF membership_tbl()Create a membership tableMTF->MT createsCLEANMT->MT READMT read_membership()Read files or data framesand coerce tomembership tableREADMT->MTF
Figure 4: Data preparation: functions (blue), classes (gold), methods (green) and their relationship during a cycle of data preparation.

However, in many cases data preparation will require wrangling with data formats (e.g. combining or joining data, filtering, modifying records). This can be done effectively inside R (for example with packages from the tidyverse collection), or outside R with other tools of preference.

Validation pipeline

Data validation allows the user to check if the data is valid for further processing. The validation functions are intended to catch common problems and pitfalls that could invalidate the final results. Validation should be completed before moving to data exploration and analysis.

membership cluster_prep Data validation pipelinecluster_main Core functionsMT Class membership_tbl(not documented)CHECKMT check_membership()Performs checks on amembership tableMT->CHECKMT inputMC Class membership_check(not documented)MCP print(membership_check)MC->MCP has methodVMT validate_membership()Validate a membership tableMC->VMT LUT Class lookup_tbl(not documented)LUT->CHECKMT input(optional)ASMT as_membership_tbl()Coerce a data frameto membership_tblMTF membership_tbl()Create a membership tableASMT->MTF CHECKMT->MC LUTF lookup_tbl()Create a lookup tablefor a classificationLUTF->LUT createsMTF->MT createsVMT->ASMT
Figure 5: Validation pipeline: functions (blue), classes (gold), methods (green) and their relationship during a cycle of validation.

Positive results of validation means that the process can move to the step of data exploration, negative results indicate that further steps of data preparation are required.

Exploration

Data exploration includes calculating basic statistics to understand the shape of the data, for example the No. of interpreters and rounds, or the distribution of membership values.

TO DO

Plot classes, summaries and other tools for exploration.

Add figure with existing and proposed functions

Data exploration could lead to identifying gaps or other shortfalls in the data. In such cases, an additional step of data preparation (and validation) might be useful before proceeding with next steps.

Data exploration will provide the basic data to inform decisions about the analysis and synthesis steps.

Analysis

Analysis steps will depend on the number of interpreters and rounds.

With one interpreter and one round, proceed directly to synthesis and outputs.

With one interpreter and multiple rounds, it is possible to analyse how uncertainty (measured as entropy) changes between rounds.

With multiple interpreters it is possible to analyse agreement and disagreement between experts in a single round, and analyse changes in uncertainty and disagreement between rounds. We refer to this process in general as expert elicitation, although the specific methods used for the consultation of interpreters can be different in different contexts.

Within rounds

TO DO

Discuss functions and their relationship

Between rounds

TO DO

Discuss functions and their relationship

Synthesis & outputs

For each unit in the source classification, what is the support for candidates in the target classification? The number of interpreters supporting a relationship, and the proportion of all membership values.

membership cluster_prep Synthesiscluster_main Core functionscluster_out Other R packagesMT Class membership_tbl(not documented)MSF summarise_membership()Summarise a membership matrixMT->MSF inputMS Class membership_summary(not documented)MSP print(membership_summary)MS->MSP has methodOTHERSF Custom scriptsspatial feature outputMS->OTHERSF OTHERXLSX Custom scriptsoutput table CSV or XLSXMS->OTHERXLSX MTF membership_tbl()Create a membership tableMTF->MT createsMSF->MS createsOTHERXLSX->OTHERSF
Figure 6: Synthesis of membership values: functions (blue), classes (gold), methods (green) and their relationship during a cycle of validation.

TO DO

Discuss functions and their relationship

For some outputs the main functions will be related to external packages:

  • Writing synthesis membership table to a file (CSV or EXCEL format)
  • Outputs to GIS data: vectors or raster attribute tables.