Table: ndb.variables#
Description#
This table lists Variables, which always consist of a Taxon and Units of measurement. Variables can also have Elements, Contexts, and Modifications. Thus, the same taxon with different measurement units (e.g. present/absent, NISP, MNI) are different Variables.
TODO: Expand this description with: - What data does this table store? - What is the business/research purpose? - How is this data collected or generated? - Are there any important caveats or data quality issues?
Table Structure#
Schema: ndb | Table Comment: This table lists Variables, which always consist of a Taxon and Units of measurement. Variables can also have Elements, Contexts, and Modifications. Thus, the same taxon with different measurement units (e.g. present/absent, NISP, MNI) are different Variables.
Statistics#
| Metric | Value |
|---|---|
| Row Count | 57,198 |
| Total Size | 18 MB |
| Table Size | 4368 kB |
| Indexes Size | 13 MB |
Relationships#
Primary Key: variableid
Foreign Keys:
taxonid→taxa.taxonidvariablecontextid→variablecontexts.variablecontextidvariableelementid→variableelements.variableelementidvariableunitsid→variableunits.variableunitsid
Referenced By:
TODO: Document which tables reference this table (will be auto-detected in validation).
Data Dictionary#
| Column | Type | Nullable | Default | Constraints | Description |
|---|---|---|---|---|---|
variableid |
integer | ✗ | nextval('ndb.seq_variables_... |
PRIMARY KEY | An arbitrary Variable identification number. |
taxonid |
integer | ✗ | - |
FOREIGN KEY, UNIQUE | Taxon identification number. Field links to the Taxa table. |
variableelementid |
integer | ✓ | - |
FOREIGN KEY, UNIQUE | Variable Element identification number. Field links to the VariableElements lookup table. |
variableunitsid |
integer | ✓ | - |
FOREIGN KEY, UNIQUE | Variable Units identification number. Field links to the VariableUnits lookup table. |
variablecontextid |
integer | ✓ | - |
FOREIGN KEY, UNIQUE | Variable Context identification number. Field links to the VariableContexts lookup table. |
recdatecreated |
timestamp without time zone | ✗ | timezone('UTC'::text, now()) |
- | |
recdatemodified |
timestamp without time zone | ✗ | - |
- |
TODO: Review column descriptions and add comments where missing.
Usage Examples#
Example 1: Basic Selection#
Purpose: Retrieve the 10 most recent records from variables
Example 2: Count Records#
Purpose: Get the total number of records in variables
Example 3: Filter by Date Range#
-- Get records within a date range
SELECT *
FROM variables
WHERE recdatecreated >= '2024-01-01'
AND recdatecreated < '2025-01-01'
ORDER BY recdatecreated DESC;
Purpose: Retrieve records from variables within a specific date range
Example 4: Join with taxa#
-- Join with related table
SELECT
t1.*,
t2.*
FROM variables t1
INNER JOIN taxa t2
ON t1.taxonid = t2.taxonid
LIMIT 100;
Purpose: Retrieve variables records with related data from taxa
Example 5: Aggregate Data#
-- Aggregate records by taxonid
SELECT
taxonid,
COUNT(*) as count
FROM variables
GROUP BY taxonid
ORDER BY count DESC
LIMIT 10;
Purpose: Count records grouped by taxonid
TODO: Add more specific examples relevant to common research questions or operational tasks.
Data Quality Notes#
Automated Data Quality Tests#
This table is subject to the following automated quality checks:
❌ valid_003: valid_terminal_taxa_have_values
- Severity: WARNING
- Status: FAILED
-
Description: Taxa that are identified as 'leaves' in the database should be associated with values in the database.
-
Suggested Remediation: - Check with data stewards for the particular data type.
- Ensure that the taxa are valid.
See the Data Quality Report for details.
Maintenance#
- Data Owner: TODO: Assign owner
- Update Frequency: TODO: Document frequency
- Last Major Schema Change: TODO: Document when schema last changed
Related Documentation#
TODO: Link to: - Related API endpoints - Data collection procedures - Analysis notebooks or reports that use this table - External ontologies or standards