# Historical Margin Summary

> Perform Historical Margin Summary through Brightree.

Source: [https://genhealth.ai/docs/workflows/integrations/brightree/brightree_historical_margin_summary](https://genhealth.ai/docs/workflows/integrations/brightree/brightree_historical_margin_summary)

Integration: [Brightree](https://genhealth.ai/docs/workflows/integrations/brightree.md)

- Handler: `brightree_historical_margin_summary`

- Connection type: `brightree`

## Inputs

- `date_from` — Date From (date)
  Optional date in YYYY-MM-DD format.
- `date_to` — Date To (date)
  Optional date in YYYY-MM-DD format.
- `min_claim_age_days` — Min Claim Age Days (number, required)
  Required numeric value.
  Default: `50`
- `min_group_orders` — Min Group Orders (number, required)
  Required numeric value.
  Default: `8`
- `top_n` — Top N (number, required)
  Required numeric value.
  Default: `15`

## Outputs

- `success` — Success
- `date_from` — Date From
- `date_to` — Date To
- `line_count` — Line Count
- `paid_line_count` — Paid Line Count
- `unpaid_line_count` — Unpaid Line Count
- `revenue` — Revenue
- `cost` — Cost
- `gp_dollars` — Gp Dollars
- `gp_pct` — Gp Pct
- `negative_pct` — Negative Pct
- `below_15_pct` — Below 15 Pct
- `below_30_pct` — Below 30 Pct
- `by_payer` — By Payer
- `by_hcpcs` — By Hcpcs
- `sku_opportunities` — Sku Opportunities
- `error` — Error

Output schema completeness: `best_effort_declared`

## Safety

- External effect: `write`
- Confirmation recommended: no
- Retry safe: no
- Dry run supported: no

## Schemas

These schemas are first-pass authoring guidance. Runtime validation remains authoritative.

### Input schema

```json
{
  "type": "object",
  "required": [
    "min_claim_age_days",
    "min_group_orders",
    "top_n"
  ],
  "properties": {
    "top_n": {
      "type": "number",
      "default": 15,
      "description": "Required numeric value.",
      "x-workflow-field-type": "number"
    },
    "date_to": {
      "type": "string",
      "format": "date",
      "description": "Optional date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "date_from": {
      "type": "string",
      "format": "date",
      "description": "Optional date in YYYY-MM-DD format.",
      "x-workflow-field-type": "date"
    },
    "min_group_orders": {
      "type": "number",
      "default": 8,
      "description": "Required numeric value.",
      "x-workflow-field-type": "number"
    },
    "min_claim_age_days": {
      "type": "number",
      "default": 50,
      "description": "Required numeric value.",
      "x-workflow-field-type": "number"
    }
  },
  "additionalProperties": false
}
```

### Output schema

```json
{
  "type": "object",
  "properties": {
    "cost": {},
    "error": {},
    "gp_pct": {},
    "date_to": {},
    "revenue": {},
    "success": {},
    "by_hcpcs": {},
    "by_payer": {},
    "date_from": {},
    "gp_dollars": {},
    "line_count": {},
    "below_15_pct": {},
    "below_30_pct": {},
    "negative_pct": {},
    "paid_line_count": {},
    "sku_opportunities": {},
    "unpaid_line_count": {}
  },
  "additionalProperties": true
}
```
