> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rcintell.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge layers overview

> How the L1-L6 knowledge graph resolves billing context from a CCN

The RCI knowledge layer resolves healthcare billing context through six hierarchical layers. Each layer builds on the previous, creating a complete billing picture from a single CCN (Medicare Provider Number).

## The six layers

| Layer  | Name              | Input            | Resolves                                                                          |
| ------ | ----------------- | ---------------- | --------------------------------------------------------------------------------- |
| **L1** | Physical Location | CCN → state      | GPCI values, MAC jurisdiction, Medicaid program, HPSA designation, timely filing  |
| **L2** | Facility Type     | CCN → type range | Payment system (OPPS/MPFS/IPPS), billing form (CMS-1500/UB-04), TOB codes         |
| **L3** | Care Setting      | L2 output        | Place of Service codes, modifier requirements, site-of-service differentials      |
| **L4** | Payer             | Payer name       | Payer-specific rules, timely filing limits, appeal deadlines, prior authorization |
| **L5** | Service Group     | CPT prefix       | E/M, surgical, radiology group rules, documentation requirements                  |
| **L6** | Service           | CPT + L1 GPCI    | Specific RVUs, GPCI-adjusted payment calculation, conversion factor               |

## How resolution works

When you submit a knowledge resolution request, the resolver chains all six layers in sequence. Each layer receives the output of prior layers so it can use accumulated context.

```
CCN "170001" → parse_ccn() → state="Kansas", type="Short-term Hospital"
  │
  ├─ L1: Kansas → GPCI(1.000, 0.891, 0.407), MAC="Jurisdiction 5"
  │       Medicaid="KanCare", timely filing, balance billing rules
  │
  ├─ L2: Short-term Hospital (CCN 0000-0879)
  │       Payment: OPPS (outpatient), IPPS (inpatient)
  │       Billing form: CMS-1500 / 837P
  │       TOB codes: 131 (outpatient), 111 (inpatient)
  │
  ├─ L3: Outpatient → POS=22, modifier requirements
  │       Site-of-service differential applied
  │
  ├─ L4: Medicare → 12-month filing limit, 120-day appeal deadline
  │       5 appeal levels, MSP rules, ABN requirements
  │
  ├─ L5: CPT 99213 → E/M Office Visit (established patient)
  │       Documentation: medical decision-making or time-based
  │
  └─ L6: 99213 → Work RVU=1.30, PE RVU=0.99, MP RVU=0.10
              → GPCI-adjusted: (1.30×1.000 + 0.99×0.891 + 0.10×0.407)
              → Payment = $80.78 (at CF $32.35)
```

## Partial resolution

Not all layers require all inputs:

* **L1-L2** require only the CCN
* **L3** benefits from a `care_setting` parameter but has sensible defaults
* **L4** requires a `payer` parameter (defaults to Medicare)
* **L5-L6** require a `cpt` code — they are skipped if not provided

This means you can call `/v1/knowledge/resolve` with just a CCN and get L1-L4, then add CPT later for the full stack.

## Data sources

| Layer | Primary Source                                                   |
| ----- | ---------------------------------------------------------------- |
| L1    | CMS GPCI tables, MAC jurisdiction assignments                    |
| L2    | CMS provider classification, facility type ranges                |
| L3    | CMS Place of Service codes, modifier guidelines                  |
| L4    | Payer documentation, CMS Medicare rules, state Medicaid programs |
| L5    | AMA CPT guidelines, CMS NCCI edits                               |
| L6    | CMS MPFS Relative Value Files, annual conversion factor          |

## API endpoints

| Endpoint                                 | Description           |
| ---------------------------------------- | --------------------- |
| `POST /v1/knowledge/resolve`             | Full L1-L6 resolution |
| `GET /v1/knowledge/layers/{ccn}`         | All layers for a CCN  |
| `GET /v1/knowledge/layers/{ccn}/{layer}` | Single layer          |
| `POST /v1/knowledge/billing-guide`       | Billing guidelines    |
| `POST /v1/knowledge/payment-calc`        | Payment calculation   |
