{
  "tool_id": "hrv_deload_trigger",
  "slug": "hrv-deload-trigger",
  "path": "/hrv-deload-trigger/",
  "mode": "engine_module",
  "usage": "Import https://aifithub.io/engines/hrv-deload-trigger.js as an ES module and call compute(input) with the fields in input_schema (every field is optional and falls back to its default). Input is validated: an unknown field, a wrong type, or a value outside enum/minimum/maximum throws an Error that names the field. The same calculator runs at https://aifithub.io/hrv-deload-trigger/.",
  "methodology": "https://aifithub.io/methodology/hrv-deload-trigger/",
  "sample_input": {
    "daily": "55,57,52,48,46,47,45",
    "baseline_30_day": 56,
    "baseline_std_dev": 0
  },
  "input_schema": {
    "type": "object",
    "properties": {
      "daily": {
        "type": "string",
        "description": "Last days of HRV, oldest first, ideally 7: comma- or space-separated numbers (\\\"55, 57, 52\\\") or a JSON array. Up to 31 values.",
        "default": "55,57,52,48,46,47,45"
      },
      "baseline_30_day": {
        "type": "number",
        "description": "Your 30-day average of the same measure.",
        "minimum": 0.01,
        "default": 56
      },
      "baseline_std_dev": {
        "type": "number",
        "description": "Day-to-day standard deviation of the 30-day baseline; omit or 0 to assume 7% of the baseline.",
        "minimum": 0,
        "default": 0
      }
    },
    "additionalProperties": false
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "warnings": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Notes when the series is not 7 days or the SD is assumed."
      },
      "baseline30Day": {
        "type": "number"
      },
      "rollingMean7Day": {
        "type": "number",
        "description": "Mean of the daily values."
      },
      "rollingDeviationPct": {
        "type": "number",
        "description": "Mean vs baseline, percent (−10.7 = 10.7% below)."
      },
      "smallestWorthwhileChange": {
        "type": "number",
        "description": "SWC = 0.5 × baseline SD, same unit as the inputs."
      },
      "daysBelowSwcInLastWeek": {
        "type": "number",
        "description": "Days more than one SWC below baseline."
      },
      "longestConsecutiveBelowSwc": {
        "type": "number",
        "description": "Longest run of consecutive days below the band."
      },
      "recommendation": {
        "type": "string",
        "enum": [
          "yes",
          "maybe",
          "no"
        ],
        "description": "no, maybe or yes."
      },
      "detail": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "index": {
              "type": "number"
            },
            "value": {
              "type": "number"
            },
            "deviationFromBaseline": {
              "type": "number"
            },
            "deviationPct": {
              "type": "number"
            },
            "belowSwc": {
              "type": "boolean"
            }
          }
        },
        "description": "Array of { index, value, deviationFromBaseline, deviationPct, belowSwc }."
      }
    }
  },
  "summary": "Deload recommendation (no / maybe / yes) from the last 7 daily HRV values (RMSSD or a readiness score) against a 30-day baseline, using a rolling mean and a smallest-worthwhile-change band of 0.5 × the baseline SD (after Plews et al.)."
}
