Architecture + ERDs for the v8 Marine Atlas DuckDB databases (serve · sdm · merge · spp)

Published

2026-08-12

The v8 Marine Atlas pipeline flows through four DuckDB databases. The one consumers query is the tiny serve.duckdb — a set of views over partitioned Parquet on S3 (KB on disk, never a multi-GB monolith). It is fed by the multi-GB build database sdm.duckdb, which in turn is assembled from the merge intermediate merge.duckdb and the taxonomy authority spp.duckdb.

0.1 Architecture

Code
flowchart TB
  src["ingest_*.qmd — one per source<br/>AquaMaps · BirdLife · IUCN/FWS/NMFS ranges · SWOT turtles"]
  spp[("<b>spp.duckdb</b><br/>WoRMS · GBIF · ITIS<br/>IUCN · BirdLife<br/><i>taxonomy authority</i>")]
  merge[("<b>merge.duckdb</b><br/>taxon · taxon_model · taxon_flags<br/>mc_parts · model_cell<br/><i>two-surface merge intermediate</i>")]
  sdm[("<b>sdm.duckdb</b> — build (multi-GB)<br/>cell · model · model_cell · taxon<br/>metric · cell_metric · zone* · native_asset")]
  s3[("<b>S3</b> marine-atlas/v8/<br/>tables/ · serve/ · dist_merged/ · registry/")]
  serve[("<b>serve.duckdb</b> — KB<br/><i>VIEWs over S3 Parquet</i>")]
  titiler["titiler-v8<br/>tile server"]
  stac["STAC catalog"]
  apps["species · scores<br/>Shiny apps"]

  src -->|"dist/dataset={ds_key}/*.parquet<br/>(mdl_key, cell_id, val)"| merge
  spp -.->|"sp_cat · is_marine · WoRMS ids"| merge
  merge -->|"merge_taxon → score_zones →<br/>score_cell_metrics → score_zone_metrics"| sdm
  sdm -->|"release_marine-atlas"| s3
  s3 --> serve
  serve --> titiler
  s3 --> stac
  titiler --> apps
  stac --> apps

  classDef db fill:#1e3a5f,stroke:#3bc9db,color:#e6edf3;
  class spp,merge,sdm,serve db;
flowchart TB
  src["ingest_*.qmd — one per source<br/>AquaMaps · BirdLife · IUCN/FWS/NMFS ranges · SWOT turtles"]
  spp[("<b>spp.duckdb</b><br/>WoRMS · GBIF · ITIS<br/>IUCN · BirdLife<br/><i>taxonomy authority</i>")]
  merge[("<b>merge.duckdb</b><br/>taxon · taxon_model · taxon_flags<br/>mc_parts · model_cell<br/><i>two-surface merge intermediate</i>")]
  sdm[("<b>sdm.duckdb</b> — build (multi-GB)<br/>cell · model · model_cell · taxon<br/>metric · cell_metric · zone* · native_asset")]
  s3[("<b>S3</b> marine-atlas/v8/<br/>tables/ · serve/ · dist_merged/ · registry/")]
  serve[("<b>serve.duckdb</b> — KB<br/><i>VIEWs over S3 Parquet</i>")]
  titiler["titiler-v8<br/>tile server"]
  stac["STAC catalog"]
  apps["species · scores<br/>Shiny apps"]

  src -->|"dist/dataset={ds_key}/*.parquet<br/>(mdl_key, cell_id, val)"| merge
  spp -.->|"sp_cat · is_marine · WoRMS ids"| merge
  merge -->|"merge_taxon → score_zones →<br/>score_cell_metrics → score_zone_metrics"| sdm
  sdm -->|"release_marine-atlas"| s3
  s3 --> serve
  serve --> titiler
  s3 --> stac
  titiler --> apps
  stac --> apps

  classDef db fill:#1e3a5f,stroke:#3bc9db,color:#e6edf3;
  class spp,merge,sdm,serve db;
Figure 1: v8 Marine Atlas data flow across the four DuckDB databases (click to zoom)

Key conventions. The public identifier is the stable mdl_key ({ds_key}|{sp_id}, pipe separator; merged taxa are ms_merge|{authority}:{id}). The dense integer mdl_id is a serving optimization only (partition-prunes titiler reads) and renumbers per release, so it never appears in URLs. Values live in a val column (value is a DuckDB reserved word); serving views expose a value alias for titiler. Scoring runs over in_usa cells; is_valid_global uses the whole-range cell tally so species outside the US still list in the app.


1 The published release — any version

serve.duckdb is a few KB of views over the partitioned Parquet published to s3://oceanmetrics.io-public/marine-atlas/{ver}/. Its content is the release, so the published schema can be read from the release itself rather than from a local build — for any version, with no server access.

This section does exactly that: it introspects the release named by SCHEMA_VER (default: this checkout’s ver), so the schema of v3 can be documented without a v3 database on disk. The sdm/merge/spp sections that follow describe the local build databases, which exist only for whichever version was last built here.

v8 — grid global05, public model id mdl_key, 13 published tables. Capabilities: cell_species_list yes · native_representation yes · programareas yes · planareas no · zone_taxon yes · score_cogs yes

1.0.1 cell — 17,072,105 rows

Column Type Description
cell_id INTEGER global 0.05° grid cell id (1:ncell)
lon DOUBLE
lat DOUBLE
depth_mean DOUBLE mean depth (m)
depth_min DOUBLE
depth_max DOUBLE
oxy_b_mean DOUBLE mean value
oxy_mean DOUBLE mean value
prim_prod_mean DOUBLE mean value
ice_con_ann DOUBLE
salinity_b_mean DOUBLE mean value
salinity_mean DOUBLE mean value
sbt_an_mean DOUBLE mean value
sst_an_mean DOUBLE annual mean SST
fao_area_m DOUBLE
area_km2 DOUBLE cell area (km²)
in_usa BOOLEAN cell in US study area
in_pra BOOLEAN cell in a BOEM Program Area

1.0.2 taxon — 37,051 rows

Column Type Description
taxon_authority VARCHAR taxonomic authority (worms/botw/…)
taxon_id VARCHAR taxon id within its authority
ms_merge_key VARCHAR merged-taxon model id ms_merge|{authority}:{id}
scientific_name VARCHAR scientific name
iucn_code VARCHAR IUCN Red List category
n_models INTEGER # raw models merged
n_datasets INTEGER # datasets merged
worms_is_marine BOOLEAN marine per WoRMS
worms_is_extinct BOOLEAN extinct per WoRMS
extrisk_code VARCHAR extinction-risk code
er_score INTEGER extinction-risk score (0-100, most-protective)
is_mmpa BOOLEAN MMPA-protected (all WoRMS Mammalia)
is_mbta BOOLEAN MBTA-protected (FWS §10.13 birds)
is_bcc BOOLEAN Bird of Conservation Concern
common_name VARCHAR common name
n_cells BIGINT merged cells (any)
n_ocean BIGINT merged ocean cells
n_usa BIGINT merged US cells
n_pra BIGINT merged Program-Area cells
range_km2 DOUBLE merged range area (km²)
range_usa_km2 DOUBLE US merged range area (km²)
n_global BIGINT whole-range merged cells (→ is_valid_global)
is_valid_global BOOLEAN valid on the WHOLE global range (drives the app’s all-species list)
is_valid_usa BOOLEAN has ≥1 merged cell in US waters (n_usa>0)
is_valid_pra BOOLEAN present in a Program Area
pct_marine DOUBLE % of range that is ocean
us_endemism DOUBLE % of ocean range in US waters
rarity VARCHAR rarity class from range_km2
sp_cat VARCHAR taxonomy-based scoring category
is_marine BOOLEAN passes the marine-relevance cull
pct_marine_bl DOUBLE % marine from the BirdLife range
in_v7 BOOLEAN in v7’s scored set
is_er_spatial BOOLEAN ER baked into cell val (turtles) so not re-scored

1.0.3 model — 80,791 rows

Column Type Description
mdl_key VARCHAR stable model id {ds_key}|{sp_id}
mdl_id INTEGER dense integer model id (serving partition key; NEVER renumbered for a published model – see assign_mdl_id)
ds_key VARCHAR dataset key
sp_id VARCHAR species id within dataset
sci_name VARCHAR scientific name
common_name VARCHAR common name
er_score DOUBLE extinction-risk score (0-100, most-protective)
sp_cat VARCHAR taxonomy-based scoring category

1.0.4 metric — 41 rows

Column Type Description
metric_seq INTEGER metric sequence id
metric_key VARCHAR key
description VARCHAR

1.0.5 cell_metric — 9,549,911 rows

Column Type Description
cell_id INTEGER global 0.05° grid cell id (1:ncell)
metric_seq INTEGER metric sequence id
val DOUBLE value (suitability 0-100 / er_score on range cells)

1.0.6 zone — 37 rows

Column Type Description
zone_seq INTEGER zone sequence id
zone_set_key VARCHAR key
tbl VARCHAR
fld VARCHAR
val VARCHAR value (suitability 0-100 / er_score on range cells)

1.0.7 zone_cell — 2,241,876 rows

Column Type Description
zone_seq INTEGER zone sequence id
cell_id INTEGER global 0.05° grid cell id (1:ncell)
pct_covered INTEGER % of cell covered by the zone

1.0.8 zone_metric — 795 rows

Column Type Description
zone_seq INTEGER zone sequence id
metric_seq INTEGER metric sequence id
val DOUBLE value (suitability 0-100 / er_score on range cells)

1.0.9 zone_taxon — 115,700 rows

Column Type Description
zone_fld VARCHAR
zone_value VARCHAR
sp_cat VARCHAR taxonomy-based scoring category
sp_common VARCHAR
sp_scientific VARCHAR
taxon_id VARCHAR taxon id within its authority
taxon_authority VARCHAR taxonomic authority (worms/botw/…)
er_code VARCHAR code
er_score DOUBLE extinction-risk score (0-100, most-protective)
is_mmpa BOOLEAN MMPA-protected (all WoRMS Mammalia)
is_mbta BOOLEAN MBTA-protected (FWS §10.13 birds)
mdl_key VARCHAR stable model id {ds_key}|{sp_id}
area_km2 DOUBLE cell area (km²)
avg_suit DOUBLE
suit_er DOUBLE
suit_er_area DOUBLE
cat_suit_er_area DOUBLE
pct_cat DOUBLE

1.0.10 dataset — 11 rows

Column Type Description
ds_key VARCHAR dataset key
name_short VARCHAR
response_type VARCHAR
source_broad VARCHAR
temporal_res VARCHAR
native_format VARCHAR native SDM format
sort_order INTEGER
qmd VARCHAR
name_original VARCHAR
description VARCHAR
citation VARCHAR
source_detail VARCHAR
regions VARCHAR
taxa_groups VARCHAR
year_pub INTEGER
date_obs_beg DATE date
date_obs_end DATE date
date_env_beg DATE date
date_env_end DATE date
link_info VARCHAR URL
link_download VARCHAR URL
link_metadata VARCHAR URL
links_other VARCHAR URL
spatial_res_deg DOUBLE
date_created DATE date
name_display VARCHAR
value_info VARCHAR
is_mask BOOLEAN mask layer
is_scored BOOLEAN boolean flag
global_mask_priority DOUBLE mask precedence

1.0.11 taxon_model — 41,015 rows

Column Type Description
mdl_key VARCHAR stable model id {ds_key}|{sp_id}
ds_key VARCHAR dataset key
taxon_authority VARCHAR taxonomic authority (worms/botw/…)
taxon_id VARCHAR taxon id within its authority
ms_merge_key VARCHAR merged-taxon model id ms_merge|{authority}:{id}

1.0.12 listing — 11,532 rows

Column Type Description
sci VARCHAR
nmfs_esa VARCHAR
is_mmpa BOOLEAN MMPA-protected (all WoRMS Mammalia)
fws_esa VARCHAR
is_bcc BOOLEAN Bird of Conservation Concern
is_mbta BOOLEAN MBTA-protected (FWS §10.13 birds)

1.0.13 native_asset — 55,220 rows

Column Type Description
ms_merge_key VARCHAR merged-taxon model id ms_merge|{authority}:{id}
mdl_key VARCHAR stable model id {ds_key}|{sp_id}
ds_key VARCHAR dataset key
asset_type VARCHAR COG | PMTiles
representation VARCHAR native (original) | model (0.05° gridded)
asset_url VARCHAR public S3/titiler URL
rescale_min INTEGER colormap min
rescale_max INTEGER colormap max
colormap VARCHAR titiler colormap name
xmin DOUBLE
xmax DOUBLE
ymin DOUBLE
ymax DOUBLE

1.1 Zone sets — geometry by vintage, not by release

zone_cell depends only on (geometry × grid), so it is not a per-release table: it lives at zones/{zone_set_key}/{grid_id}/zone_cell.parquet and one extraction serves every release on that grid. Measured, one program-area geometry covers v2–v8 and one ecoregion geometry covers v1–v8.

The registry that settles which vintage a release used is data/zone_sets.csv, and each release’s manifest names its zone_set_key per spatial unit — which is what lets an app (or this documentation) draw the correct outlines for the version being viewed instead of the newest ones.

zone_set_key zone_type vintage n_zones versions canonical
ecoregion_2025-06 ecoregion 2025-06 12 v1 v2 v3 v4 v4b v5 v6 v7 v8 FALSE
planarea_2025-06 planarea 2025-06 36 v1 v2 v3 v4 v4b v5 v6 v7 FALSE
programarea_2026-01 programarea 2026-01 20 v2 v3 v4 v4b v5 v6 v7 v8 FALSE
subregion_2025-06 subregion 2025-06 4 v1 v4 v4b v5 v6 v8 TRUE
subregion_2025-08 subregion 2025-08 4 v1 v4 v4b v5 v6 v8 FALSE

2 serve.duckdb — the local view database

titiler resolves mdl_key → mdl_id and reads a single serve/model_cell/mdl_id=*/…parquet partition per tile (anonymous HTTP range read).

Warningserve.duckdb schema drift — update the ERD + expected list in schema.qmd
  • dataset new columns: is_scored
  • native_asset missing columns: source_layer
  • zone new columns: zone_set_key

2.1 Schema

Code
erDiagram
  dataset {
    VARCHAR ds_key        PK "dataset key"
    VARCHAR name_short        "short display name"
    VARCHAR response_type     "suitability, range, …"
    VARCHAR native_format     "native SDM format"
  }
  model {
    VARCHAR mdl_key       PK "stable {ds_key}|{sp_id}"
    INTEGER mdl_id           "dense serving id"
    VARCHAR ds_key        FK "-> dataset"
    VARCHAR sci_name
    DOUBLE  er_score
    VARCHAR sp_cat
  }
  model_cell {
    VARCHAR mdl_key       FK "-> model"
    INTEGER mdl_id           "serving partition key"
    INTEGER cell_id       FK "-> cell"
    DOUBLE  val              "suitability 0-100"
  }
  cell {
    INTEGER cell_id       PK "0.05° grid id"
    DOUBLE  lon
    DOUBLE  lat
    DOUBLE  area_km2
    BOOLEAN in_usa
    BOOLEAN in_pra
  }
  taxon {
    VARCHAR ms_merge_key  PK "merged model id"
    VARCHAR taxon_authority
    VARCHAR taxon_id
    VARCHAR scientific_name
    DOUBLE  er_score
    VARCHAR sp_cat
    BOOLEAN is_valid_global "whole-range validity"
    BOOLEAN is_valid_usa    "n_usa>0"
  }
  native_asset {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR mdl_key       FK "-> model"
    VARCHAR ds_key        FK "-> dataset"
    VARCHAR asset_type       "COG | PMTiles"
    VARCHAR representation   "native | model"
    VARCHAR asset_url        "public S3/titiler URL"
  }
  metric {
    INTEGER metric_seq    PK
    VARCHAR metric_key
  }
  cell_metric {
    INTEGER cell_id       FK "-> cell"
    INTEGER metric_seq    FK "-> metric"
    DOUBLE  val
  }
  zone {
    INTEGER zone_seq      PK
    VARCHAR tbl              "program areas / ecoregions"
    VARCHAR val              "zone key"
  }
  zone_cell {
    INTEGER zone_seq      FK "-> zone"
    INTEGER cell_id       FK "-> cell"
    INTEGER pct_covered
  }
  zone_metric {
    INTEGER zone_seq      FK "-> zone"
    INTEGER metric_seq    FK "-> metric"
    DOUBLE  val
  }

  dataset ||--|{ model        : ds_key
  model   ||--|{ model_cell   : mdl_key
  model   ||--o{ native_asset : mdl_key
  taxon   ||--o{ native_asset : ms_merge_key
  cell    ||--|{ model_cell   : cell_id
  cell    ||--|{ cell_metric  : cell_id
  cell    ||--|{ zone_cell    : cell_id
  metric  ||--|{ cell_metric  : metric_seq
  metric  ||--|{ zone_metric  : metric_seq
  zone    ||--|{ zone_cell    : zone_seq
  zone    ||--|{ zone_metric  : zone_seq
erDiagram
  dataset {
    VARCHAR ds_key        PK "dataset key"
    VARCHAR name_short        "short display name"
    VARCHAR response_type     "suitability, range, …"
    VARCHAR native_format     "native SDM format"
  }
  model {
    VARCHAR mdl_key       PK "stable {ds_key}|{sp_id}"
    INTEGER mdl_id           "dense serving id"
    VARCHAR ds_key        FK "-> dataset"
    VARCHAR sci_name
    DOUBLE  er_score
    VARCHAR sp_cat
  }
  model_cell {
    VARCHAR mdl_key       FK "-> model"
    INTEGER mdl_id           "serving partition key"
    INTEGER cell_id       FK "-> cell"
    DOUBLE  val              "suitability 0-100"
  }
  cell {
    INTEGER cell_id       PK "0.05° grid id"
    DOUBLE  lon
    DOUBLE  lat
    DOUBLE  area_km2
    BOOLEAN in_usa
    BOOLEAN in_pra
  }
  taxon {
    VARCHAR ms_merge_key  PK "merged model id"
    VARCHAR taxon_authority
    VARCHAR taxon_id
    VARCHAR scientific_name
    DOUBLE  er_score
    VARCHAR sp_cat
    BOOLEAN is_valid_global "whole-range validity"
    BOOLEAN is_valid_usa    "n_usa>0"
  }
  native_asset {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR mdl_key       FK "-> model"
    VARCHAR ds_key        FK "-> dataset"
    VARCHAR asset_type       "COG | PMTiles"
    VARCHAR representation   "native | model"
    VARCHAR asset_url        "public S3/titiler URL"
  }
  metric {
    INTEGER metric_seq    PK
    VARCHAR metric_key
  }
  cell_metric {
    INTEGER cell_id       FK "-> cell"
    INTEGER metric_seq    FK "-> metric"
    DOUBLE  val
  }
  zone {
    INTEGER zone_seq      PK
    VARCHAR tbl              "program areas / ecoregions"
    VARCHAR val              "zone key"
  }
  zone_cell {
    INTEGER zone_seq      FK "-> zone"
    INTEGER cell_id       FK "-> cell"
    INTEGER pct_covered
  }
  zone_metric {
    INTEGER zone_seq      FK "-> zone"
    INTEGER metric_seq    FK "-> metric"
    DOUBLE  val
  }

  dataset ||--|{ model        : ds_key
  model   ||--|{ model_cell   : mdl_key
  model   ||--o{ native_asset : mdl_key
  taxon   ||--o{ native_asset : ms_merge_key
  cell    ||--|{ model_cell   : cell_id
  cell    ||--|{ cell_metric  : cell_id
  cell    ||--|{ zone_cell    : cell_id
  metric  ||--|{ cell_metric  : metric_seq
  metric  ||--|{ zone_metric  : metric_seq
  zone    ||--|{ zone_cell    : zone_seq
  zone    ||--|{ zone_metric  : zone_seq
Figure 2: serve.duckdb entity relationship diagram (click to zoom)

2.2 Tables

Every table above is a view (SELECT * FROM read_parquet('s3://…/tables/{table}.parquet')), so its columns mirror the sdm.duckdb core tables documented next (with live row counts + value ranges) — plus, on the serving views, the titiler value alias of val and the mdl_id join on model_cell. Row counts here would require an anonymous S3 scan and are omitted.


3 sdm.duckdb — build database

The multi-GB database release_marine-atlas exports to S3. Same core tables as serve (serve is a view over its Parquet); model_cell here is (mdl_key, cell_id, val) — the mdl_id join and value alias are added at serve time. Also holds build-only scratch/experimental tables (hex*, wtmp*, v7_cat, v7_ok) not shown here.

Warningsdm.duckdb schema drift — update the ERD + expected list in schema.qmd
  • dataset new columns: is_scored
  • native_asset missing columns: source_layer
  • zone new columns: zone_set_key

3.1 Tables


4 merge.duckdb — two-surface merge intermediate

merge_models writes both surfaces here: a global viz surface (am ∪ range) and the US-scoped v7-faithful scoring surface (model_cell). merge_taxon derives per-taxon validity (taxon, from taxon_cell + taxon_cell_global), governing extinction risk (taxon_er), and the has_am/has_range flags (taxon_flags) that drive the no-EEZ AquaMaps constraint. score_zones copies taxon from here into sdm.duckdb.

merge.duckdb matches the documented schema.

4.1 Schema

Code
erDiagram
  taxon_model {
    VARCHAR mdl_key       PK "raw input model"
    VARCHAR ms_merge_key  FK "-> taxon (merged)"
    VARCHAR taxon_authority
    VARCHAR taxon_id
  }
  taxon {
    VARCHAR ms_merge_key  PK "merged model id"
    VARCHAR scientific_name
    INTEGER er_score
    VARCHAR sp_cat
    BOOLEAN is_valid_global
    BIGINT  n_global
  }
  taxon_flags {
    VARCHAR ms_merge_key  FK "-> taxon"
    BOOLEAN has_am           "has AquaMaps model"
    BOOLEAN has_range        "has range polygon"
  }
  taxon_cell {
    VARCHAR mdl_key       FK "-> taxon (ms_merge_key)"
    BIGINT  n_ocean
    BIGINT  n_usa
    DOUBLE  range_km2
  }
  taxon_cell_global {
    VARCHAR mdl_key       FK "-> taxon (ms_merge_key)"
    BIGINT  n_global         "whole-range cells"
  }
  taxon_er {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR extrisk_code
    INTEGER er_score
    BOOLEAN is_mmpa
  }
  mc_parts {
    BIGINT  mkey_id       FK "-> mkey_map"
    VARCHAR ms_merge_key
    VARCHAR ds_key
    INTEGER cell_id       FK "-> us_cells"
    DOUBLE  val
  }
  model_cell {
    VARCHAR mdl_key       PK "merged US scoring surface"
    INTEGER cell_id       FK "-> us_cells"
    DOUBLE  value
  }
  mkey_map {
    VARCHAR ms_merge_key  PK
    INTEGER mkey_id          "dense id"
  }
  turtle_src {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR ds_key
    INTEGER cell_id
    DOUBLE  val
  }
  us_cells {
    INTEGER cell_id       PK "in_usa grid cells"
  }
  listing {
    VARCHAR sci           PK "scientific name"
    VARCHAR nmfs_esa
    VARCHAR fws_esa
    BOOLEAN is_mmpa
  }

  taxon ||--|{ taxon_model       : ms_merge_key
  taxon ||--|| taxon_flags       : ms_merge_key
  taxon ||--|| taxon_er          : ms_merge_key
  taxon ||--o{ turtle_src        : ms_merge_key
  taxon ||--|| taxon_cell        : ms_merge_key
  taxon ||--|| taxon_cell_global : ms_merge_key
  mkey_map ||--|{ mc_parts       : mkey_id
  us_cells ||--|{ mc_parts       : cell_id
  us_cells ||--|{ model_cell     : cell_id
erDiagram
  taxon_model {
    VARCHAR mdl_key       PK "raw input model"
    VARCHAR ms_merge_key  FK "-> taxon (merged)"
    VARCHAR taxon_authority
    VARCHAR taxon_id
  }
  taxon {
    VARCHAR ms_merge_key  PK "merged model id"
    VARCHAR scientific_name
    INTEGER er_score
    VARCHAR sp_cat
    BOOLEAN is_valid_global
    BIGINT  n_global
  }
  taxon_flags {
    VARCHAR ms_merge_key  FK "-> taxon"
    BOOLEAN has_am           "has AquaMaps model"
    BOOLEAN has_range        "has range polygon"
  }
  taxon_cell {
    VARCHAR mdl_key       FK "-> taxon (ms_merge_key)"
    BIGINT  n_ocean
    BIGINT  n_usa
    DOUBLE  range_km2
  }
  taxon_cell_global {
    VARCHAR mdl_key       FK "-> taxon (ms_merge_key)"
    BIGINT  n_global         "whole-range cells"
  }
  taxon_er {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR extrisk_code
    INTEGER er_score
    BOOLEAN is_mmpa
  }
  mc_parts {
    BIGINT  mkey_id       FK "-> mkey_map"
    VARCHAR ms_merge_key
    VARCHAR ds_key
    INTEGER cell_id       FK "-> us_cells"
    DOUBLE  val
  }
  model_cell {
    VARCHAR mdl_key       PK "merged US scoring surface"
    INTEGER cell_id       FK "-> us_cells"
    DOUBLE  value
  }
  mkey_map {
    VARCHAR ms_merge_key  PK
    INTEGER mkey_id          "dense id"
  }
  turtle_src {
    VARCHAR ms_merge_key  FK "-> taxon"
    VARCHAR ds_key
    INTEGER cell_id
    DOUBLE  val
  }
  us_cells {
    INTEGER cell_id       PK "in_usa grid cells"
  }
  listing {
    VARCHAR sci           PK "scientific name"
    VARCHAR nmfs_esa
    VARCHAR fws_esa
    BOOLEAN is_mmpa
  }

  taxon ||--|{ taxon_model       : ms_merge_key
  taxon ||--|| taxon_flags       : ms_merge_key
  taxon ||--|| taxon_er          : ms_merge_key
  taxon ||--o{ turtle_src        : ms_merge_key
  taxon ||--|| taxon_cell        : ms_merge_key
  taxon ||--|| taxon_cell_global : ms_merge_key
  mkey_map ||--|{ mc_parts       : mkey_id
  us_cells ||--|{ mc_parts       : cell_id
  us_cells ||--|{ model_cell     : cell_id
Figure 3: merge.duckdb entity relationship diagram (click to zoom)

4.2 Tables


5 spp.duckdb — taxonomy authority

Read-only reference of five taxonomic sources (each with a _vernacular common-name table). merge_taxon reads WoRMS class/phylum for the taxonomy-based sp_cat, isMarine/isExtinct flags, and BirdLife (botw) for the marine-bird determination.

spp.duckdb matches the documented schema.

5.1 Schema

Code
erDiagram
  worms {
    INTEGER taxonID          PK "WoRMS AphiaID"
    VARCHAR scientificName
    VARCHAR class
    VARCHAR phylum
    VARCHAR family
    BOOLEAN isMarine
    BOOLEAN isExtinct
  }
  worms_vernacular {
    INTEGER taxonID          FK "-> worms"
    VARCHAR vernacularName
  }
  botw {
    DOUBLE  taxonID          PK "BirdLife id"
    VARCHAR scientificName
    VARCHAR redlist_code
    VARCHAR family
  }
  botw_vernacular {
    DOUBLE  taxonID          FK "-> botw"
    VARCHAR vernacularName
  }
  gbif {
    INTEGER taxonID          PK "GBIF id"
    VARCHAR canonicalName
    VARCHAR taxonRank
    VARCHAR family
  }
  gbif_vernacular {
    DOUBLE  taxonID          FK "-> gbif"
    VARCHAR vernacularName
  }
  itis {
    INTEGER taxonID          PK "ITIS TSN"
    VARCHAR scientificName
    VARCHAR taxonRank
  }
  itis_vernacular {
    INTEGER taxonID          FK "-> itis"
    VARCHAR vernacularName
  }
  iucn_redlist {
    INTEGER sis_taxon_id     PK "IUCN SIS id"
    VARCHAR taxon_scientific_name
    VARCHAR red_list_category_code
    BOOLEAN latest
  }
  iucn_vernacular {
    DOUBLE  taxonID          FK "-> iucn_redlist"
    VARCHAR vernacularName
  }

  worms        ||--|{ worms_vernacular : taxonID
  botw         ||--|{ botw_vernacular  : taxonID
  gbif         ||--|{ gbif_vernacular  : taxonID
  itis         ||--|{ itis_vernacular  : taxonID
  iucn_redlist ||--|{ iucn_vernacular  : "sis_taxon_id = taxonID"
erDiagram
  worms {
    INTEGER taxonID          PK "WoRMS AphiaID"
    VARCHAR scientificName
    VARCHAR class
    VARCHAR phylum
    VARCHAR family
    BOOLEAN isMarine
    BOOLEAN isExtinct
  }
  worms_vernacular {
    INTEGER taxonID          FK "-> worms"
    VARCHAR vernacularName
  }
  botw {
    DOUBLE  taxonID          PK "BirdLife id"
    VARCHAR scientificName
    VARCHAR redlist_code
    VARCHAR family
  }
  botw_vernacular {
    DOUBLE  taxonID          FK "-> botw"
    VARCHAR vernacularName
  }
  gbif {
    INTEGER taxonID          PK "GBIF id"
    VARCHAR canonicalName
    VARCHAR taxonRank
    VARCHAR family
  }
  gbif_vernacular {
    DOUBLE  taxonID          FK "-> gbif"
    VARCHAR vernacularName
  }
  itis {
    INTEGER taxonID          PK "ITIS TSN"
    VARCHAR scientificName
    VARCHAR taxonRank
  }
  itis_vernacular {
    INTEGER taxonID          FK "-> itis"
    VARCHAR vernacularName
  }
  iucn_redlist {
    INTEGER sis_taxon_id     PK "IUCN SIS id"
    VARCHAR taxon_scientific_name
    VARCHAR red_list_category_code
    BOOLEAN latest
  }
  iucn_vernacular {
    DOUBLE  taxonID          FK "-> iucn_redlist"
    VARCHAR vernacularName
  }

  worms        ||--|{ worms_vernacular : taxonID
  botw         ||--|{ botw_vernacular  : taxonID
  gbif         ||--|{ gbif_vernacular  : taxonID
  itis         ||--|{ itis_vernacular  : taxonID
  iucn_redlist ||--|{ iucn_vernacular  : "sis_taxon_id = taxonID"
Figure 4: spp.duckdb entity relationship diagram (click to zoom)

5.2 Tables