Skip to content

Table: ndb.sampleages#

Description#

This table stores sample ages. Ages are assigned to a Chronology. Because there may be more than one Chronology for a Collection Unit, samples may be assigned different ages for different Chronologies. A simple example is one sample age in radiocarbon years and another in calibrated radiocarbon years. The age units are an attribute of the Chronology.

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#

Visual Schema

Schema: ndb | Table Comment: This table stores sample ages. Ages are assigned to a Chronology. Because there may be more than one Chronology for a Collection Unit, samples may be assigned different ages for different Chronologies. A simple example is one sample age in radiocarbon years and another in calibrated radiocarbon years. The age units are an attribute of the Chronology.

Statistics#

Metric Value
Row Count 950,838
Total Size 383 MB
Table Size 76 MB
Indexes Size 307 MB

Relationships#

Primary Key: sampleageid

Foreign Keys:

Referenced By:

TODO: Document which tables reference this table (will be auto-detected in validation).

Data Dictionary#

Column Type Nullable Default Constraints Description
sampleageid integer nextval('ndb.seq_sampleages... PRIMARY KEY An arbitrary Sample Age identification number.
sampleid integer - FOREIGN KEY Sample identification number. Field links to the Samples table.
chronologyid integer - FOREIGN KEY Chronology identification number. Field links to the Chronologies table.
age double precision - - Age of the sample
ageyounger double precision - - Younger error estimate of the age. The definition of this estimate is an attribute of the Chronology. Many ages do not have explicit error estimates assigned.
ageolder double precision - - Older error estimate of the age.
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#

-- Get recent records from sampleages
SELECT *
FROM sampleages
ORDER BY sampleageid DESC
LIMIT 10;

Purpose: Retrieve the 10 most recent records from sampleages

Example 2: Count Records#

-- Count total records
SELECT COUNT(*) as total_records
FROM sampleages;

Purpose: Get the total number of records in sampleages

Example 3: Filter by Date Range#

-- Get records within a date range
SELECT *
FROM sampleages
WHERE recdatecreated >= '2024-01-01'
  AND recdatecreated < '2025-01-01'
ORDER BY recdatecreated DESC;

Purpose: Retrieve records from sampleages within a specific date range

Example 4: Join with chronologies#

-- Join with related table
SELECT 
    t1.*,
    t2.*
FROM sampleages t1
INNER JOIN chronologies t2 
    ON t1.chronologyid = t2.chronologyid
LIMIT 100;

Purpose: Retrieve sampleages records with related data from chronologies

Example 5: Aggregate Data#

-- Aggregate records by sampleid
SELECT 
    sampleid,
    COUNT(*) as count
FROM sampleages
GROUP BY sampleid
ORDER BY count DESC
LIMIT 10;

Purpose: Count records grouped by sampleid

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:

✅ comp_004: sample_ages_for_samples

  • Severity: WARNING
  • Status: PASSED
  • Description: Samples should have sample ages, whether from a chronology or collection date.

❌ valid_005: sample_ages_scaled_properly

  • Severity: ERROR
  • Status: FAILED
  • Description: Sample ages and chronologies should have ages that have the correct age range. younger ages should always be more recent than older ages.

  • Suggested Remediation: - Likely we just need to flip the ages around from younger to older.

  • The chronology may also need some examination.

✅ biz_001: modern_samples_have_recent_dates

  • Severity: WARNING
  • Status: PASSED
  • Description: Samples marked as modern should have dates after 1950

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

TODO: Link to: - Related API endpoints - Data collection procedures - Analysis notebooks or reports that use this table - External ontologies or standards