# Conceptual Health™ — Sub-Signal Inventory
#
# Every measurable signal that feeds one of the 8 axes (PO, NM, ER, SC, RS, ES,
# TA, PV).  These are the raw observations the patient records, the device
# emits, the clinician charts, or the partner system syncs.  The axis
# aggregator (backend/app/health/axis_aggregator.py) reduces each axis's
# signals into a 0–100 score; the Master Equation then folds the 8 axes into
# Conceptual Health™.
#
# Source-of-truth chain:
#   master-equation/sub-signals.yaml     ← this file
#   backend/app/health/axis_aggregator.py← reads this YAML
#   master-equation/action-axis-map.yaml ← maps user actions → these signal IDs
#
# Schema:
#   axes:
#     <AXIS_CODE>:
#       name: <human label>
#       role: <wing role in master equation>
#       weight_default: <within-axis weight, 0..1>   (sums to 1.0 per axis)
#       signals:
#         - id: <stable_snake_case_id>
#           name: <human label>
#           unit: <unit string or "score" / "count" / "minutes" / "boolean">
#           source: <self_report | wearable | clinical | lab | partner_api>
#           cadence: <continuous | daily | weekly | monthly | episodic>
#           value_range: [min, max]            # raw observation range
#           polarity: <higher_is_better | lower_is_better | optimal_band>
#           optimal_band: [lo, hi]              # only when polarity = optimal_band
#           weight: <0..1 within axis>          # contribution to the axis score
#           hcr_lane: <hcr lane id or null>     # which HCR mining lane rewards it
#           hcc_eligible: <true | false>        # eligible for HCC settlement
#           notes: <optional>
#
# All signal IDs are stable.  Renaming a signal requires a migration and a
# golden-vector update so external validators do not silently break.
#
# Patent: U.S. Provisional 63/921,717.

version: 1
schema_revision: "2026-05-14"

axes:

  # ──────────────────────────────────────────────────────────────────
  # PO — Physical & Outdoor   (S half, with NM)
  # ──────────────────────────────────────────────────────────────────
  PO:
    name: Physical & Outdoor
    role: "S · Somatic foundation (with NM)"
    weight_default: 0.125
    signals:
      - id: po_steps_daily
        name: Daily steps
        unit: count
        source: wearable
        cadence: daily
        value_range: [0, 30000]
        polarity: higher_is_better
        weight: 0.18
        hcr_lane: hcr_movement
        hcc_eligible: true
      - id: po_active_minutes
        name: Active minutes (≥3 METs)
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 600]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: hcr_movement
        hcc_eligible: true
      - id: po_resting_heart_rate
        name: Resting heart rate
        unit: bpm
        source: wearable
        cadence: daily
        value_range: [30, 120]
        polarity: optimal_band
        optimal_band: [50, 70]
        weight: 0.10
        hcr_lane: hcr_cardio
        hcc_eligible: false
      - id: po_vo2_max
        name: VO₂ max
        unit: ml_kg_min
        source: wearable
        cadence: weekly
        value_range: [15, 80]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_cardio
        hcc_eligible: false
      - id: po_sleep_minutes
        name: Sleep duration
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [120, 720]
        polarity: optimal_band
        optimal_band: [420, 540]
        weight: 0.14
        hcr_lane: hcr_recovery
        hcc_eligible: true
      - id: po_sleep_quality
        name: Sleep quality (deep + REM %)
        unit: percent
        source: wearable
        cadence: daily
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_recovery
        hcc_eligible: false
      - id: po_outdoor_minutes
        name: Outdoor time
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 600]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_nature
        hcc_eligible: true
      - id: po_sun_exposure_safe
        name: Safe sun exposure
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 180]
        polarity: optimal_band
        optimal_band: [10, 30]
        weight: 0.06
        hcr_lane: hcr_nature
        hcc_eligible: false
      - id: po_strength_sessions
        name: Strength sessions
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 14]
        polarity: optimal_band
        optimal_band: [2, 5]
        weight: 0.08
        hcr_lane: hcr_movement
        hcc_eligible: true
      - id: po_injury_flag
        name: Active injury
        unit: boolean
        source: self_report
        cadence: episodic
        value_range: [0, 1]
        polarity: lower_is_better
        weight: 0.04
        hcr_lane: null
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # NM — Nutritional & Metabolic   (S half, with PO)
  # ──────────────────────────────────────────────────────────────────
  NM:
    name: Nutritional & Metabolic
    role: "S · Somatic foundation (with PO)"
    weight_default: 0.125
    signals:
      - id: nm_whole_food_ratio
        name: Whole-food ratio
        unit: percent
        source: self_report
        cadence: daily
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.16
        hcr_lane: hcr_nutrition
        hcc_eligible: true
      - id: nm_water_intake
        name: Water intake
        unit: liters
        source: self_report
        cadence: daily
        value_range: [0, 6]
        polarity: optimal_band
        optimal_band: [1.8, 3.5]
        weight: 0.10
        hcr_lane: hcr_nutrition
        hcc_eligible: true
      - id: nm_protein_grams
        name: Protein
        unit: grams
        source: self_report
        cadence: daily
        value_range: [0, 250]
        polarity: optimal_band
        optimal_band: [80, 160]
        weight: 0.10
        hcr_lane: hcr_nutrition
        hcc_eligible: false
      - id: nm_added_sugar
        name: Added sugar
        unit: grams
        source: self_report
        cadence: daily
        value_range: [0, 200]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: hcr_nutrition
        hcc_eligible: false
      - id: nm_alcohol_units
        name: Alcohol
        unit: units
        source: self_report
        cadence: daily
        value_range: [0, 20]
        polarity: lower_is_better
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: nm_fasting_glucose
        name: Fasting glucose
        unit: mg_dl
        source: lab
        cadence: monthly
        value_range: [50, 250]
        polarity: optimal_band
        optimal_band: [70, 99]
        weight: 0.12
        hcr_lane: null
        hcc_eligible: false
      - id: nm_hba1c
        name: HbA1c
        unit: percent
        source: lab
        cadence: monthly
        value_range: [4.0, 14.0]
        polarity: optimal_band
        optimal_band: [4.5, 5.6]
        weight: 0.12
        hcr_lane: null
        hcc_eligible: false
      - id: nm_bmi
        name: BMI
        unit: kg_m2
        source: clinical
        cadence: monthly
        value_range: [12, 50]
        polarity: optimal_band
        optimal_band: [19, 25]
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: nm_lipid_ldl
        name: LDL cholesterol
        unit: mg_dl
        source: lab
        cadence: monthly
        value_range: [40, 250]
        polarity: optimal_band
        optimal_band: [50, 100]
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: nm_supplement_adherence
        name: Supplement adherence
        unit: percent
        source: self_report
        cadence: daily
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.06
        hcr_lane: hcr_nutrition
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # ER — Emotional & Relational   (Resilience wing factor)
  # ──────────────────────────────────────────────────────────────────
  ER:
    name: Emotional & Relational
    role: "ER · Resilience wing factor"
    weight_default: 0.125
    signals:
      - id: er_mood_self_rating
        name: Daily mood self-rating
        unit: score
        source: self_report
        cadence: daily
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.16
        hcr_lane: hcr_mind
        hcc_eligible: true
      - id: er_phq9
        name: PHQ-9 (depression)
        unit: score
        source: clinical
        cadence: monthly
        value_range: [0, 27]
        polarity: lower_is_better
        weight: 0.16
        hcr_lane: null
        hcc_eligible: false
      - id: er_gad7
        name: GAD-7 (anxiety)
        unit: score
        source: clinical
        cadence: monthly
        value_range: [0, 21]
        polarity: lower_is_better
        weight: 0.14
        hcr_lane: null
        hcc_eligible: false
      - id: er_hrv_rmssd
        name: HRV RMSSD
        unit: ms
        source: wearable
        cadence: daily
        value_range: [10, 200]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_recovery
        hcc_eligible: false
      - id: er_journal_entries
        name: Journal entries
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 14]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_mind
        hcc_eligible: true
      - id: er_quality_relationships
        name: Quality-relationship contacts
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 30]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_mind
        hcc_eligible: false
      - id: er_conflict_index
        name: Conflict / stress events
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 20]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: er_therapy_attendance
        name: Therapy / counseling attendance
        unit: boolean
        source: clinical
        cadence: weekly
        value_range: [0, 1]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_mind
        hcc_eligible: false
      - id: er_substance_misuse
        name: Substance-misuse flag
        unit: boolean
        source: self_report
        cadence: weekly
        value_range: [0, 1]
        polarity: lower_is_better
        weight: 0.06
        hcr_lane: null
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # SC — Social & Communal   (Sp · Coherence amplifier)
  # ──────────────────────────────────────────────────────────────────
  SC:
    name: Social & Communal
    role: "Sp · Coherence amplifier"
    weight_default: 0.125
    signals:
      - id: sc_in_person_contacts
        name: In-person meaningful contacts
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 50]
        polarity: higher_is_better
        weight: 0.18
        hcr_lane: hcr_community
        hcc_eligible: true
      - id: sc_volunteer_minutes
        name: Volunteer / service minutes
        unit: minutes
        source: self_report
        cadence: weekly
        value_range: [0, 600]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: hcr_community
        hcc_eligible: true
      - id: sc_loneliness_scale
        name: UCLA loneliness short
        unit: score
        source: self_report
        cadence: monthly
        value_range: [3, 12]
        polarity: lower_is_better
        weight: 0.14
        hcr_lane: null
        hcc_eligible: false
      - id: sc_group_membership_active
        name: Active group memberships
        unit: count
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_community
        hcc_eligible: false
      - id: sc_support_received
        name: Support-received rating
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: sc_support_given
        name: Support-given rating
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_community
        hcc_eligible: false
      - id: sc_family_meals
        name: Shared family meals
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 21]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_community
        hcc_eligible: false
      - id: sc_civic_participation
        name: Civic / voting participation
        unit: boolean
        source: self_report
        cadence: monthly
        value_range: [0, 1]
        polarity: higher_is_better
        weight: 0.06
        hcr_lane: null
        hcc_eligible: false
      - id: sc_screen_passive_social
        name: Passive social-media minutes
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 720]
        polarity: lower_is_better
        weight: 0.06
        hcr_lane: null
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # RS — Religious & Spiritual   (Resilience wing factor)
  # ──────────────────────────────────────────────────────────────────
  RS:
    name: Religious & Spiritual
    role: "RS · Resilience wing factor"
    weight_default: 0.125
    signals:
      - id: rs_meditation_minutes
        name: Meditation / contemplative practice
        unit: minutes
        source: self_report
        cadence: daily
        value_range: [0, 180]
        polarity: higher_is_better
        weight: 0.18
        hcr_lane: hcr_mind
        hcc_eligible: true
      - id: rs_prayer_minutes
        name: Prayer / devotion
        unit: minutes
        source: self_report
        cadence: daily
        value_range: [0, 180]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: hcr_mind
        hcc_eligible: true
      - id: rs_service_attendance
        name: Service / gathering attendance
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 7]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_community
        hcc_eligible: false
      - id: rs_gratitude_practice
        name: Gratitude practice
        unit: count
        source: self_report
        cadence: daily
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_mind
        hcc_eligible: true
      - id: rs_purpose_in_life
        name: Purpose-in-life rating
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: null
        hcc_eligible: false
      - id: rs_forgiveness_practice
        name: Forgiveness practice
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_mind
        hcc_eligible: false
      - id: rs_scripture_study
        name: Scripture / wisdom study
        unit: minutes
        source: self_report
        cadence: daily
        value_range: [0, 180]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_mind
        hcc_eligible: false
      - id: rs_existential_distress
        name: Existential distress
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: lower_is_better
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: rs_awe_experiences
        name: Awe / transcendence experiences
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 14]
        polarity: higher_is_better
        weight: 0.06
        hcr_lane: hcr_nature
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # ES — Environmental & Stewardship   (Right-wing addend)
  # ──────────────────────────────────────────────────────────────────
  ES:
    name: Environmental & Stewardship
    role: "E · Right-wing addend"
    weight_default: 0.125
    signals:
      - id: es_air_quality_exposure
        name: Air-quality exposure (AQI)
        unit: aqi
        source: partner_api
        cadence: daily
        value_range: [0, 500]
        polarity: lower_is_better
        weight: 0.14
        hcr_lane: null
        hcc_eligible: false
      - id: es_water_quality
        name: Drinking-water quality index
        unit: score
        source: partner_api
        cadence: monthly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: es_green_space_minutes
        name: Green-space minutes
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 360]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_nature
        hcc_eligible: true
      - id: es_recycle_compost
        name: Recycle / compost practice
        unit: boolean
        source: self_report
        cadence: weekly
        value_range: [0, 1]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_stewardship
        hcc_eligible: true
      - id: es_carbon_footprint
        name: Estimated weekly carbon
        unit: kg_co2e
        source: partner_api
        cadence: weekly
        value_range: [0, 600]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: hcr_stewardship
        hcc_eligible: false
      - id: es_home_air_filter
        name: Home air-filter maintenance
        unit: boolean
        source: self_report
        cadence: monthly
        value_range: [0, 1]
        polarity: higher_is_better
        weight: 0.06
        hcr_lane: hcr_stewardship
        hcc_eligible: false
      - id: es_noise_exposure
        name: Sustained noise exposure
        unit: db_hours
        source: wearable
        cadence: daily
        value_range: [0, 24]
        polarity: lower_is_better
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: es_local_food_ratio
        name: Local / seasonal food ratio
        unit: percent
        source: self_report
        cadence: weekly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_stewardship
        hcc_eligible: true
      - id: es_active_commute
        name: Active / low-emission commute
        unit: percent
        source: wearable
        cadence: weekly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_stewardship
        hcc_eligible: true
      - id: es_household_chemicals
        name: Low-tox household products
        unit: percent
        source: self_report
        cadence: monthly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false

  # ──────────────────────────────────────────────────────────────────
  # TA — Technological & Adaptive   (Right-wing addend)
  # ──────────────────────────────────────────────────────────────────
  TA:
    name: Technological & Adaptive
    role: "T · Right-wing addend"
    weight_default: 0.125
    signals:
      - id: ta_screen_active_minutes
        name: Active screen-time
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 900]
        polarity: optimal_band
        optimal_band: [60, 240]
        weight: 0.12
        hcr_lane: null
        hcc_eligible: false
      - id: ta_focus_blocks
        name: Deep-focus blocks (≥25 min)
        unit: count
        source: wearable
        cadence: daily
        value_range: [0, 12]
        polarity: higher_is_better
        weight: 0.12
        hcr_lane: hcr_learning
        hcc_eligible: true
      - id: ta_skill_minutes
        name: Skill-building / learning
        unit: minutes
        source: self_report
        cadence: daily
        value_range: [0, 240]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: hcr_learning
        hcc_eligible: true
      - id: ta_security_hygiene
        name: Security hygiene (MFA, updates)
        unit: percent
        source: self_report
        cadence: monthly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_learning
        hcc_eligible: false
      - id: ta_telehealth_engagement
        name: Telehealth visit adherence
        unit: percent
        source: clinical
        cadence: monthly
        value_range: [0, 100]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: ta_data_consent_active
        name: Active research data consents
        unit: count
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_research
        hcc_eligible: true
      - id: ta_adaptive_devices
        name: Adaptive devices used effectively
        unit: count
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: ta_ai_assist_quality
        name: AI-assist outcome rating
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_learning
        hcc_eligible: false
      - id: ta_doomscroll_minutes
        name: Doomscroll / addictive feed
        unit: minutes
        source: wearable
        cadence: daily
        value_range: [0, 720]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: ta_innovation_action
        name: Innovation actions logged
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 14]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_research
        hcc_eligible: true

  # ──────────────────────────────────────────────────────────────────
  # PV — Provisional & Vocational   (Right-wing exponent · p)
  # ──────────────────────────────────────────────────────────────────
  PV:
    name: Provisional & Vocational
    role: "p · Right-wing exponent"
    weight_default: 0.125
    signals:
      - id: pv_purposeful_work_minutes
        name: Purposeful-work minutes
        unit: minutes
        source: self_report
        cadence: daily
        value_range: [0, 720]
        polarity: higher_is_better
        weight: 0.14
        hcr_lane: hcr_vocation
        hcc_eligible: true
      - id: pv_income_stability
        name: Income-stability rating
        unit: score
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: pv_emergency_fund_months
        name: Emergency-fund months
        unit: months
        source: self_report
        cadence: monthly
        value_range: [0, 24]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: pv_debt_to_income
        name: Debt-to-income ratio
        unit: ratio
        source: self_report
        cadence: monthly
        value_range: [0, 5]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: pv_career_growth_action
        name: Career-growth actions
        unit: count
        source: self_report
        cadence: weekly
        value_range: [0, 14]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_vocation
        hcc_eligible: true
      - id: pv_planning_horizon_months
        name: Planning horizon (months)
        unit: months
        source: self_report
        cadence: monthly
        value_range: [0, 120]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: null
        hcc_eligible: false
      - id: pv_mentor_relationships
        name: Mentor / mentee relationships
        unit: count
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: hcr_vocation
        hcc_eligible: false
      - id: pv_role_alignment
        name: Role-alignment rating
        unit: score
        source: self_report
        cadence: weekly
        value_range: [0, 10]
        polarity: higher_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: pv_burnout_index
        name: Burnout index (MBI short)
        unit: score
        source: self_report
        cadence: monthly
        value_range: [0, 10]
        polarity: lower_is_better
        weight: 0.10
        hcr_lane: null
        hcc_eligible: false
      - id: pv_volunteer_vocation
        name: Vocational service hours
        unit: minutes
        source: self_report
        cadence: weekly
        value_range: [0, 1200]
        polarity: higher_is_better
        weight: 0.08
        hcr_lane: hcr_vocation
        hcc_eligible: true
