otters

Synced from hadley/otters

A real-world data-dict.yaml, synced from hadley/otters. Browse the rendered dictionary, or download the raw file.

otters.yaml
# source: https://github.com/hadley/otters

$version: "0.1.0"
$learn_more: http://data-dict.tidyverse.org/

name: alaska-otters
description: >
  Morphometric measurements and reproductive and dependency status for sea
  otters captured or collected in Alaska by the U.S. Geological Survey (USGS)
  and U.S. Fish and Wildlife Service (USFWS), 1947-2019.
details: >
  Source: <https://doi.org/10.5066/P9Q5PD3Y>
tables:
  - name: otters
    source:
      parquet: otters.parquet
    description: >
      One row per otter. Of the 4,507 otters, 113 have measurements from more
      than one capture or collection event.
    columns:
      - name: otter_no
        type: string
        constraints: [primary_key]
        description: >
          Identifier assigned by researchers. Naming conventions vary by
          location and period, but identifiers are not reused. Two unnamed
          measured pups were assigned `synthetic-1` and `synthetic-2` during
          cleaning.
        examples: ["67001", "70066", "90-044", "KOD-04-135", "SW-155"]

      - name: sex
        type: enum
        values: {M: Male, F: Female, U: Unknown}
        description: >
          Sex recorded for the otter.

      - name: recap
        type: boolean
        description: >
          Whether the otter was recorded as recaptured. This agrees with the
          number of `measurements` rows except for SW-155, which is marked as
          recaptured but has one row, and SO-04-05a, which is marked as captured
          once but has two. The latter's 2008-05-18 row may belong to pup
          SO-04-05b.

  - name: measurements
    source:
      parquet: measurements.parquet
    description: >
      One row per capture or collection event. An otter caught more than once
      has multiple rows. This includes 173 dependent-pup measurements separated
      from fields on the accompanying female's record during cleaning.
    columns:
      - name: measurement_id
        type: number(id)
        constraints: [primary_key]
        description: >
          Identifier assigned during cleaning to each capture or collection
          event. Values run from 1 to 4,643 and have no source-data meaning.
        examples: [1, 1200, 2500, 4000, 4643]

      - name: otter_no
        type: string
        constraints: [required, foreign_key]
        description: >
          Identifier of the otter captured or collected.
        examples: ["67001", "70066", "90-044", "KOD-04-135", "SW-155"]

      - name: date
        type: date
        range: [1947-05-02, 2019-05-30]
        description: >
          Date of capture or collection. Together with `otter_no`, this
          identifies an event except for KWK-59-162: a post-captivity weighing
          appears to retain the original capture date rather than the weighing
          date of 1959-05-13.

      - name: location
        type: string
        constraints: [required, foreign_key]
        description: >
          Local place name for the capture or collection site. See `locations`
          for its region and area.
        examples: [adak, chiniak bay, kiska, SE - whale bay, yukon island]

      - name: lat
        type: number(quantity)
        range: [51.3721, 60.7025]
        description: >
          Latitude of capture or collection location in decimal degrees
          (WGS84).

      - name: long
        type: number(quantity)
        range: [-178.964, 179.3966]
        description: >
          Longitude of capture or collection location in decimal degrees
          (WGS84).

      - name: weight
        type: number(quantity)
        range: [0.8, 45.4]
        description: >
          Otter weight in kilograms.

      - name: tail_lgth
        type: number(quantity)
        range: [15.5, 37.0]
        description: >
          Mean tail length in centimeters. Individual measurements are in
          `replicates`.

      - name: curvilinear
        type: boolean
        description: >
          Whether length was measured along the curve of the back rather than
          in a straight line. The source recorded this as the 0.974 conversion
          factor, which is already applied in `true_standard_lgth`. It is
          unknown for the 173 dependent-pup events separated from their
          mother's record during cleaning.

      - name: lgth
        type: number(quantity)
        range: [40.2, 148.2]
        description: >
          Mean standard length including the tail, in centimeters. Individual
          measurements are in `replicates`; four events have a value only here.

      - name: true_standard_lgth
        type: number(quantity)
        range: [40.2, 155.9]
        description: >
          Length including the tail, standardized across measurement protocols,
          in centimeters. It equals `lgth` for standard measurements and
          `curve_lgth` multiplied by 0.974 for curvilinear measurements.

      - name: body_lgth
        type: number(quantity)
        range: [56.5, 115.2]
        description: >
          Body length excluding the tail, in centimeters, calculated as
          `true_standard_lgth - tail_lgth`. Available for the 401 events where
          both values are known.

      - name: curve_lgth
        type: number(quantity)
        range: [47.0, 160.0]
        description: >
          Curvilinear length including the tail, in centimeters. It was measured
          once per event and therefore has no rows in `replicates`.

      - name: curve_lgth_alt
        type: number(quantity)
        range: [111.5, 166.0]
        description: >
          Unidentified length in centimeters, named `CURVE_LGTH2` in the source
          but not a replicate of `curve_lgth`. Its 21 values are from 2006-03-29
          to 2006-04-08 at nknight and montague and exceed `curve_lgth` by
          12-23 cm. What was measured is unknown.

      - name: girth
        type: number(quantity)
        range: [29.5, 96.5]
        description: >
          Mean chest circumference at the xiphoid, in centimeters. Individual
          measurements are in `replicates`.

      - name: paw
        type: number(quantity)
        range: [34.0, 63.0]
        description: >
          Maximum front-paw width in millimeters.

      - name: w_pup
        type: enum
        values:
          'N': Not with dependent pup
          'U': Unknown
          'D': The individual is the dependent pup
          'Y': With dependent pup
        description: >
          Dependency status at capture or collection. `Y` without a
          `pup_number` means a pup was seen but not identified; 251 events have
          this combination, and those pups have no rows of their own.

      - name: pup_number
        type: string
        constraints: [foreign_key]
        description: >
          Identifier of the dependent pup accompanying the female. Measurements
          stored on the female's source record were separated into an event for
          the pup during cleaning.
        examples: ["67002", "92-198", "KOD_04_121", "SO-08-20", "SO-98-50a"]

      - name: fetus_pres
        type: enum
        values:
          'N': No fetus present
          'Y': Fetus present
          'M': Multiple fetuses present
        description: >
          Fetal presence at collection. The code matches the number of related
          `fetuses` rows: none for `N`, one for `Y`, and two or three for `M`.

      - name: fe_rep_con
        type: enum
        values:
          IMP: Implanted pregnant
          UNI: Unimplanted pregnant
          ANE: Anestrous
          EST: In estrous
          POS: Postpartum
          PRO: In proestrus
          FAI: Pregnancy failure (resorption or possible abortion)
        description: >
          Reproductive condition recorded for a female.

      - name: fe_rep_sta
        type: enum
        values: {'N': Nulliparous, 'M': Multiparous, 'P': Primiparous}
        description: >
          Parity recorded for a collected female.

      - name: pregnancy_status
        type: enum
        values:
          NP: Not pregnant at collection or capture
          U: Unknown
          NPP: Not palpably pregnant at capture
          P: Fetus present at collection or palpably pregnant at capture
          PP: Not documented in the source metadata
        description: >
          Pregnancy status at capture or collection.

      - name: can_dia
        type: number(quantity)
        range: [2.9, 11.1]
        description: >
          Maximum canine-tooth diameter at the gum line, in millimeters.

      - name: final_age
        type: number(ordinal)
        range: [0, 23]
        description: >
          Age at capture or collection, in years, based on known age, tooth
          cementum, or a field estimate.

      - name: age_category
        type: enum
        values:
          '<1': Less than 1 year
          '1-2': 1-2 years
          '3-10': 3-10 years
          '>10': Greater than 10 years
        description: >
          Broad age class at capture or collection.

      - name: bacula_lgth
        type: number(quantity)
        range: [2.2, 21.6]
        description: >
          Baculum length in centimeters, recorded for males.

      - name: comments
        type: string
        description: >
          Free-text notes about the otter or event.
        examples: ["given 92-114", "died summer 1997", "originally 84-001", "pup < 8 wks later but preg missed at capture"]

      - name: cause_of_death_capture_method
        type: enum
        values:
          live capture: Typical live capture
          harvest: Collected via harvest
          captivity: Measured after some time in captivity
          beach: Captured off a beach
        description: >
          Capture or collection method.

  - name: replicates
    source:
      parquet: replicates.parquet
    description: >
      One row per individual tail-length, standard-length, or girth measurement.
      Tail length has multiple measurements for 287 of 403 events, standard
      length for 160 of 2,269, and girth for 4 of 1,052. Replicated tail lengths
      differ by a median of 0.5 cm.
    columns:
      - name: measurement_id
        type: number(id)
        constraints: [primary_key, foreign_key]
        description: >
          Identifier of the capture or collection event.
        examples: [2071, 2476, 3031, 3686, 4397]

      - name: quantity
        type: enum
        values:
          tail_lgth: Length of tail, 15.5 to 37.2 cm
          lgth: Length of otter including tail, 40.2 to 148.2 cm
          girth: Circumference of chest at xiphoid, 29.5 to 96.5 cm
        constraints: [primary_key]
        description: >
          Measurement type. The corresponding `measurements` column contains
          the mean for the event.

      - name: replicate
        type: number(ordinal)
        constraints: [primary_key]
        range: [1, 3]
        description: >
          Sequence number in source order, starting at 1. Girth has at most two
          measurements per event.

      - name: value
        type: number(quantity)
        constraints: [required]
        range: [15.5, 148.2]
        description: >
          Measurement in centimeters, recorded to one decimal place. See
          `quantity` for type-specific ranges.

  - name: locations
    source:
      parquet: locations.parquet
    description: >
      One row per named capture or collection place, with its region and area.
    columns:
      - name: location
        type: string
        constraints: [primary_key]
        description: >
          Place name recorded for capture or collection events.
        examples: [adak, chiniak bay, kiska, SE - whale bay, yukon island]

      - name: region
        type: enum
        values:
          west aleutians: Western Aleutian Islands
          east aleutians: Eastern Aleutian Islands
          AK peninsula: Alaska Peninsula
          kodiak: Kodiak Island
          lower cook inlet: Lower Cook Inlet
          PWS: Prince William Sound
          SE: Southeast Alaska
        description: >
          Alaska region containing the place; a region may contain multiple
          areas.

      - name: area
        type: enum
        values:
          near islands: Near Island group
          rats: Rat Island group
          delarofs: Delarof Island group
          andreanofs: Andreanof Island group
          fox islands: Fox Island group
          WAP: Western Alaska Peninsula
          EAP: Eastern Alaska Peninsula
          shuyak: Shuyak Island
          afognak: Afognak Island
          kodiak: Kodiak Island
          kachemak: Kachemak Bay
          WPWS: Western Prince William Sound
          EPWS: Eastern Prince William Sound
          NSE: Northern Southeast Alaska
          CSE: Central Southeast Alaska
          SSE: Southern Southeast Alaska
        description: >
          Alaska area containing the place.

  - name: fetuses
    source:
      parquet: fetuses.parquet
    description: >
      One row per fetus found in a collected female. A collection with multiple
      fetuses has multiple rows.
    columns:
      - name: measurement_id
        type: number(id)
        constraints: [primary_key, foreign_key]
        description: >
          Identifier of the collection event at which the fetus was found.
        examples: [15, 759, 1329, 1830, 3696]

      - name: fetus_num
        type: number(ordinal)
        constraints: [primary_key]
        range: [1, 3]
        description: >
          Index distinguishing fetuses within a collection, numbered from 1 in
          no meaningful order; it is not a fetus count.

      - name: fetus_sex
        type: enum
        values: {M: Male, F: Female, U: Unknown}
        description: >
          Sex recorded for the fetus.

      - name: fetus_wt
        type: number(quantity)
        range: [0.1, 2112.0]
        description: >
          Fetal weight in grams.

      - name: fetus_lth
        type: number(quantity)
        range: [0.3, 65.0]
        description: >
          Fetal length in centimeters.

relationships:
  - description: >
      Links each otter to its capture or collection events.
    cardinality: one-to-many
    join: otters.otter_no = measurements.otter_no

  - description: >
      Links an event to its individual tail-length, standard-length, and girth
      measurements. The 2,370 events with none of these measurements have no
      related rows.
    cardinality: one-to-many
    join: measurements.measurement_id = replicates.measurement_id

  - description: >
      Links a collection event to fetuses found in the female.
    cardinality: one-to-many
    join: measurements.measurement_id = fetuses.measurement_id

  - description: >
      Links an event to the region and area containing its location.
    cardinality: many-to-one
    join: measurements.location = locations.location

  - description: >
      Links an event involving a female with a named dependent pup to that pup.
      Each of the 388 named pups has an `otters` row; when pup measurements are
      available, they appear in the pup's own same-day `measurements` row.
    cardinality: many-to-one
    join: measurements.pup_number = otters.otter_no

glossary:
  curvilinear length: >
    Length measured along the curve of the back while the otter lies on its
    stomach, used primarily during experimental harvests from 1967 to 1971.
  standard length: >
    Straight-line length measured while the otter lies on its back, used from
    1947 to 1963 and from 1986 to 2019.
  true standard length: >
    Length standardized across protocols: standard length is unchanged, while
    curvilinear length is multiplied by 0.974.
  experimental harvest: >
    Controlled collection of sea otters for research, primarily during the
    1960s and 1970s.
  nulliparous: >
    A female that has never given birth.
  primiparous: >
    A female that has given birth once.
  multiparous: >
    A female that has given birth multiple times.
  baculum: >
    Penile bone, whose length can be used to estimate age class.
  xiphoid: >
    Lower portion of the sternum, used as the landmark for girth measurements.