Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. The following logic is required for fish

    1. Code Block
      FROM bdbsa.suvisit sv
      JOIN bdbsa.supatch sp ON sv."PATCHID" = sp."PATCHID" 
      join bdbsa.suspecies spp on sv."VISITNR" = spp."VISITNR"
      join bdbsa.vssp vs on vs."NSXCODE" = spp."NSXCODE"
      full join bdbsa.analyses_length_wide alw on alw."VISITNR"= spp."VISITNR" and alw."SPECIESTYPE"= spp."SPECIESTYPE" and alw."NSXCODE" =spp."NSXCODE" 
      full join bdbsa.sutrap str on str."VISITNR" = sv."VISITNR"
      where (spp."SPECIESTYPE" = 'F')
  2. The following variables will be ingested:` species_name, NUMOBSERVED, total_length, disc_length, mantle_length, fork_length, lower_jaw_fork_length, SPCOMM, SEX, WEIGHT, ACTIVITY, PLANTEDRELEASED, FYKENETDUR, FYKENETNR, BAITTRAPHRS, BAITTRAPNUM

Ignore me, working notes

occurrence and survey-based records. For Reptiles

  1. The following

...

  1. logic/joins are required

    1. Code Block
      FROM bdbsa.suvisit sv
      JOIN bdbsa.supatch sp ON sv."PATCHID" = sp."PATCHID" 
      join bdbsa.suspecies spp on sv."VISITNR" = spp."VISITNR"
      join bdbsa.vssp vs on vs."NSXCODE" = spp."NSXCODE"
      full join bdbsa.

...

    1. analyses_length_wide alw on 

...

    1. alw."VISITNR"

...

    1. = 

...

    1. spp."VISITNR" 

...

    1. and 

...

    1. alw."

...

    1. SPECIESTYPE"

...

    1. = 

...

    1. spp."SPECIESTYPE" and 

...

    1. alw."NSXCODE" =

...

Separate records into animal individuals and populations

The surveys contain data for animal individuals (tern_survey_suspecies_animal_individual) and populations (tern_survey_suspecies_animal_population). This needs to be separated into two tables.

The following filter can identify animal individuals

Code Block
where ("SEX" is not null or "TEATS" is not null or "VAGINA" is not null
 or "POUCH" is not null or "NUMPOUCH" is not null or "TESTES" is not null or "WEIGHT" is not null
 or "SNOUT" is not null or "ISGRAVID" is not null or "LENGTH" is not null)

Animal populations can be identified by the complement of the filter above (i.e. where the values in the columns above are null).

The following variables will be ingested for individuals, see sections below as NUMTRAP and LENGTH variables need further processing. Also create dipnetused variable where the value is YES when DIPNETHRS is not null.

Code Block
spp."SPECIESTYPE", concat_ws(' ', vs."GENUS", vs."SP") as species_name, 
spp."MACROHABNR",spp."MICROHABNR", spp."SPCOMM" ,
spp."SEX", spp."TEATS",  spp."VAGINA" ,  spp."POUCH" ,  spp."NUMPOUCH" , 
spp."TESTES", spp."WEIGHT" ,  spp."SNOUT" ,  spp."ISGRAVID",
spp."LENGTH",  spp."LENGTHMETHOD", spp."ACTIVITY",
spp."PLANTEDRELEASED", str."NUMNIGHTS",  str."NUMELLIOTTRAPA",
str."NUMELLIOTNIGHTS",  str."NUMPITTRAPA", str."NUMPITNIGHTS",
str."NUMCAGETRAPA",  str."NUMCAGENIGHTS",  str."ISHARPTRAP", str."ISMISTNET",
str."NUMELLIOTTRAPB",  str."NUMPITTRAPB",  str."NUMCAGETRAPB", str."ISHAIRTUBE",
str."ISBATDETECTOR",  str."DIPNETHRS"

For the animal population table, the following variables will be ingested

Code Block
spp."SPECIESTYPE", concat_ws(' ', vs."GENUS", vs."SP") as species_name, 
spp."NUMOBSERVED", spp."MACROHABNR", spp."MICROHABNR",  spp."SPCOMM" , spp."SIGHTINGNR" ,
spp."ACTIVITY", spp."PLANTEDRELEASED", str."NUMNIGHTS",  str."NUMELLIOTTRAPA",
str."NUMELLIOTNIGHTS",  str."NUMPITTRAPA", str."NUMPITNIGHTS",
str."NUMCAGETRAPA",  str."NUMCAGENIGHTS",  str."ISHARPTRAP", str."ISMISTNET",
str."NUMELLIOTTRAPB",  str."NUMPITTRAPB",  str."NUMCAGETRAPB", str."ISHAIRTUBE",
str."ISBATDETECTOR",  str."DIPNETHRS"

BIRDS

For individuals, a single record exists and won’t be ingested.

...

    1. spp."NSXCODE" 
      full join bdbsa.sutrap str on str."VISITNR" = sv."VISITNR"
      where (spp."SPECIESTYPE" = 'R')
  1. The following variables will be ingested: STRATANR, MACROHABNR, species_name, NUMOBSERVED, total_length, tail_length, SPCOMM, SEX, WEIGHT, ISGRAVID, PLANTEDRELEASED, NUMNIGHTS, NUMELLIOTTRAP, NUMELLIOTNIGHTS, NUMPITTRAP, NUMPITNIGHTS, NUMCAGETRAP, NUMCAGENIGHTS

...