Skip to content

O2 consumption pipeline: transmitter tagging, manual input, and rate calculation #141

Description

@shaheinm

Overview

Build a proper O2 consumption data pipeline so the CCR Information section shows real data instead of "No CCR gas data available." This replaces the current placeholder with computed values from tank pressure data or manual user input.

Design

Data Sources (in priority order)

  1. Transmitter on O2 cylinder: If the user tags one of their tank pressure transmitters as being on an O2 cylinder, we can calculate:

    • O2 consumed = start pressure - end pressure (from tankPressure1Bar or tankPressure2Bar samples)
    • O2 rate = O2 consumed / bottom time (converted to appropriate units)
  2. Manual input: If the user doesn't have a transmitter on O2, allow them to input O2 consumed during the dive (e.g., "I used 800 psi of O2"). We then calculate the rate for them.

Transmitter Configuration

Need a way for users to define which transmitter channel maps to which cylinder:

  • Tank 1 = ? (e.g., "Bailout", "O2", "Diluent", unlabeled)
  • Tank 2 = ? (e.g., "Bailout", "O2", "Diluent", unlabeled)

This could be:

  • Per-device configuration (in device settings) — "My Petrel 3's T1 is always O2"
  • Per-dive override (in dive edit) — in case the user swaps transmitter assignments

Gas Consumed Stat Card

Regardless of O2 calculation, show a "Gas Consumed" stat card for any dive with tank pressure data:

  • Value: max(tankPressure) - min(tankPressure) in psi or bar
  • Label: transmitter label if configured, otherwise "Tank 1" / "Tank 2"

CCR Information Section

Transform the current placeholder into a real data display:

  • O2 Rate: computed from tagged transmitter data or manual input
  • O2 Consumed: from transmitter delta or manual input
  • Hide the section entirely when no O2 data is available (no "No data" placeholder)

Schema Changes

Possible additions:

  • devices table: tank1_label TEXT, tank2_label TEXT (or a separate transmitter_config table)
  • dives table: o2_consumed_manual_psi REAL, o2_consumed_manual_bar REAL (for manual input)
  • Or compute O2 rate/consumed on-the-fly from samples + transmitter config (no new dive columns needed)

Out of Scope

  • Per-sensor PPO2 display (separate chart, already exists)
  • Automatic cylinder identification from gas analysis (future ML feature)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Nice-to-have improvementenhancementNew feature or requestimportDive data import and syncuiUser interface

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions