ropensci / allodb

An R package for biomass estimation at extratropical forest plots.
https://docs.ropensci.org/allodb/
GNU General Public License v3.0
36 stars 11 forks source link

how to generate new equation_id's #51

Closed gonzalezeb closed 6 years ago

gonzalezeb commented 6 years ago

How do I generate a new equation_id at the same time that I am:

  1. adding a new site, therefore likely new equations
  2. adding a new equation for an existing site

This is a direct question for @maurolepore

maurolepore commented 6 years ago

@gonzalezeb,

Here is what I think the process would look like. It seems more difficult to explain than to do. Hopefully what I say here makes sense, but it might be better to practice with a tiny, dummy database with the most important columns and 2-3 rows (e.g. table site with columns site and equation_id, and table equations with columns equation_id and equation_allometry).

  1. If you add a new site, you would add a row in the sites table (sitespecies I believe?).

    1.1. If that new site uses an equation_allometry that already exists in the equations table, then in the sites table add the equation_id corresponding to the relevant equation_allometry (which lives in the equations table).

    1.2. If that new site uses a new equation_allometry -- i.e. not already in the equations table -- then you would add a new row in the equations table: Populate the column equation_allometry with whatever you get from the literature, and populate the column equation_id with a random id from data-raw/available_random_ids.csv (here). (Remove each id that you pick, so you don't assign the same id to two different equations).

  2. If you add a new equation for an already existing site, then the equations table gets a new row as in 1.2.. And the sites table also gets a new row, where the value for the column equation_id matches the equation_id correponding to the relevant equation_allometry in the equaitons table.

Again, I'm afraid my explanation might be unclear or my rationale wrong. Best to practice and check we got it rigth. We could meet online if you want, and try a few things together.

maurolepore commented 6 years ago

Sorry, I closed accidentally.

maurolepore commented 6 years ago

Closing because this has been already discussed and we are ok.