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

# 6.3: Production Readiness

> Optimize model performance, create operator documentation, set up monitoring, and complete the handoff checklist for going live.

<Panel>
  <Card title="Accounting Academy" className="accounting-academy-card">
    <div className="accounting-academy-content">
      <Steps className="my-0">
        <Step title="MODULE 1: Fundamentals" icon="bookmark" iconType="solid" stepNumber={1} titleSize="p">
          * [1.1: Core Concepts & the Data Lifecycle](/accounting-academy/module-1/1-1-core-concepts-data-lifecycle)
          * [1.2: Translating Methodologies to Mangrove](/accounting-academy/module-1/1-2-translating-methodologies-to-mangrove)
          * [1.3: Events and Datapoints](/accounting-academy/module-1/1-3-events-and-datapoints)
          * [Exercise: Design and Build](/accounting-academy/module-1/1-exercise-design-and-build)
        </Step>

        <Step title="MODULE 2: Calculations" icon="bookmark" iconType="solid" stepNumber={2} titleSize="p">
          * [2.1: Calculation Architecture](/accounting-academy/module-2/2-1-calculation-architecture)
          * [2.2: Expanding Your Data Model](/accounting-academy/module-2/2-2-expanding-your-data-model)
          * [Exercise: Multi-Step Calculations](/accounting-academy/module-2/2-exercise-multi-step-calculations)
        </Step>

        <Step title="MODULE 3: Batch Partitioning & LCA" icon="bookmark" iconType="solid" stepNumber={3} titleSize="p">
          * [3.1: What Is a Batch?](/accounting-academy/module-3/3-1-what-is-a-batch)
          * [3.2: Batch Partitioning Strategies](/accounting-academy/module-3/3-2-batch-partitioning)
          * [3.3: Life Cycle Assessment & Emissions](/accounting-academy/module-3/3-3-lca-and-emissions)
          * [3.4: Allocating Emissions to Batches](/accounting-academy/module-3/3-4-allocating-emissions-to-batches)
          * [Exercise: Batch Partitioning & LCA](/accounting-academy/module-3/3-exercise-batch-partitioning-and-lca)
        </Step>

        <Step title="MODULE 4: Mass Balance with Ledgers" icon="bookmark" iconType="solid" stepNumber={4} titleSize="p">
          * [4.1: Introduction to Mass Balance](/accounting-academy/module-4/4-1-intro-to-mass-balance)
          * [4.2: Designing the Ledger Structure](/accounting-academy/module-4/4-2-designing-the-ledger-structure)
          * [4.3: Multiple Batch Types for Different Stages](/accounting-academy/module-4/4-3-multiple-batch-types)
          * [Exercise: Design & Build Mass Balance](/accounting-academy/module-4/4-exercise-design-and-build-mass-balance)
        </Step>

        <Step title="MODULE 5: Integration Testing" icon="bookmark" iconType="solid" stepNumber={5} titleSize="p">
          * [5.1: The Complete Model Assembly](/accounting-academy/module-5/5-1-the-complete-model-assembly)
          * [5.2: Testing Patterns](/accounting-academy/module-5/5-2-testing-patterns)
          * [5.3: Common Integration Pitfalls](/accounting-academy/module-5/5-3-common-integration-pitfalls)
          * [Exercise: Integration Testing](/accounting-academy/module-5/5-exercise-integration-testing)
        </Step>

        <Step title="MODULE 6: Advanced Patterns & Production" icon="bookmark" iconType="solid" stepNumber={6} titleSize="p">
          * [6.1: Model Design Best Practices](/accounting-academy/module-6/6-1-model-design-best-practices)
          * [6.2: Advanced Techniques](/accounting-academy/module-6/6-2-advanced-techniques)
          * [6.3: Production Readiness](/accounting-academy/module-6/6-3-production-readiness)
          * [Exercise: Production Deployment](/accounting-academy/module-6/6-exercise-production-deployment)
        </Step>
      </Steps>
    </div>
  </Card>
</Panel>

<Check>
  **What you'll learn in this lesson:**

  * Optimize model performance for production-scale data volumes
  * Create documentation that enables operators to manage the project independently
  * Define monitoring requirements and alert conditions
  * Complete the production handoff checklist
</Check>

A model that works with test data isn't necessarily ready for production. This lesson covers the final steps to make your project robust, documented, and operable at scale.

## Performance optimization

Production projects process much more data than test environments. Optimize before going live.

### Common performance bottlenecks

| Bottleneck                 | Symptom                             | Fix                                                            |
| -------------------------- | ----------------------------------- | -------------------------------------------------------------- |
| Too many model nodes       | Slow batch generation               | Consolidate redundant intermediate nodes                       |
| Unnecessary aggregations   | Model recalculates unchanged values | Review `should_aggregate` flags — only set where needed        |
| Large date ranges          | Batch generation times out          | Use narrower accounting periods (monthly instead of quarterly) |
| Complex Keisan expressions | Slow per-batch computation          | Simplify expressions or break into multiple simpler nodes      |

<Tip>
  Start with the simplest model that satisfies the methodology. Optimize only if batch generation takes more than a few minutes for a typical period. Premature optimization adds complexity without benefit.
</Tip>

### Testing at scale

Before going live, test with a **realistic data volume**:

<Steps>
  <Step title="Estimate production volume">
    How many events per month? How many batches will be generated? For Mangrove Biochar: \~20 deliveries/month = \~20 batches/month.
  </Step>

  <Step title="Load a full period of data">
    Create or import a full month's worth of events at the expected volume.
  </Step>

  <Step title="Time the batch generation">
    Run Generate Batches and note how long it takes. If it exceeds 5 minutes, investigate optimization.
  </Step>

  <Step title="Verify outputs at scale">
    Spot-check 3-5 batches against expected values. Verify ledger totals are reasonable.
  </Step>
</Steps>

## Operator documentation

The person who builds the model isn't always the person who operates it day-to-day. Documentation bridges this gap.

### What to document

<CardGroup cols={2}>
  <Card title="Data Collection Guide" icon="clipboard-list">
    For the team collecting data:

    * What events to create and when
    * Required datapoints and formats
    * How to <a href="/data-collection/add-data" target="_blank" rel="noopener noreferrer">add events</a> (manual or <a href="/data-collection/bulk-import" target="_blank" rel="noopener noreferrer">bulk import</a>)
    * Evidence requirements per event type
    * Naming conventions for tracking IDs
  </Card>

  <Card title="Operations Guide" icon="gears">
    For the team running the accounting:

    * When to <a href="/production-accounting/generate-batches" target="_blank" rel="noopener noreferrer">generate batches</a> (cadence, accounting period selection)
    * How to resolve validation errors
    * Expected output ranges and red flags
    * Ledger reconciliation procedures
    * How to <a href="/reporting/report-production" target="_blank" rel="noopener noreferrer">generate reports</a>
  </Card>
</CardGroup>

### Where to document

Add descriptions directly in Mangrove where possible:

* **Event type descriptions** — explain the purpose and data source
* **Datapoint descriptions** — specify units, acceptable ranges, and source
* **Model node descriptions** — explain the calculation and its methodology reference

<Note>
  In-platform documentation is the most durable — it stays with the project and is visible to anyone who opens it. Supplementary documentation (SOPs, runbooks) should reference the in-platform descriptions, not duplicate them.
</Note>

## Monitoring and alerting

Once live, you need to know when something goes wrong **before** it affects reporting.

### What to monitor

| Metric                    | Expected Behavior           | Alert When                                                   |
| ------------------------- | --------------------------- | ------------------------------------------------------------ |
| Events created per period | Consistent with operations  | Significant drop (missing data) or spike (duplicate imports) |
| Batch outputs             | Within expected range       | Value outside ±20% of historical average                     |
| Ledger balance            | Non-negative, growing       | Goes negative or unexpectedly flat                           |
| Validation errors         | Zero                        | Any persistent validation errors during batch generation     |
| Data completeness         | All required events present | Missing event types for an accounting period                 |

### Setting up monitoring

<Steps>
  <Step title="Define thresholds">
    Based on your testing results, define what "normal" looks like for each metric. Use the Module 5 test results as a baseline.
  </Step>

  <Step title="Schedule regular checks">
    Set a cadence for reviewing the monitoring metrics — weekly or before each batch generation.
  </Step>

  <Step title="Create an escalation path">
    Define who to contact when an alert fires. Include the Mangrove implementation team for platform-level issues.
  </Step>
</Steps>

## Production handoff checklist

Before declaring a project "production-ready," walk through this final checklist:

### Configuration

* [ ] All event types configured with correct datapoints, slugs, and descriptions
* [ ] All static inputs populated with current emission factors and methodology parameters
* [ ] Model validated — all nodes produce correct outputs in the Console
* [ ] Batch types configured with correct partition cadence and output types
* [ ] Ledgers configured with correct units, credit/debit sources, and allocation rules

### Testing

* [ ] Happy path tests pass — normal data produces correct outputs
* [ ] Edge case tests pass — boundary values are handled correctly
* [ ] Volume test pass — batch generation completes in reasonable time at production scale
* [ ] Ledger reconciliation verified — no negative balances, inputs ≥ outputs

### Documentation

* [ ] Event type descriptions written in-platform
* [ ] Datapoint descriptions include units, ranges, and source
* [ ] Model node descriptions reference methodology equations
* [ ] Data collection guide created for operators
* [ ] Operations guide created for accounting team

### Operational readiness

* [ ] Monitoring thresholds defined
* [ ] Review cadence established
* [ ] Escalation path documented
* [ ] First live accounting period scheduled
* [ ] Operator training completed

<Warning>
  Don't skip the handoff. A project that only the builder understands is a single point of failure. Documentation and training ensure the project survives team changes.
</Warning>

***

### Check your understanding

<Accordion title="What 4 areas should a production readiness review cover?" icon="circle-question">
  **Configuration** (all components properly set up), **Testing** (happy path, edge cases, volume, and reconciliation), **Documentation** (in-platform descriptions plus operator guides), and **Operational readiness** (monitoring, cadences, escalation, training). All four must be complete before going live.
</Accordion>

<Accordion title="Why is in-platform documentation preferred over external documents?" icon="circle-question">
  In-platform documentation (event type descriptions, datapoint descriptions, model node descriptions) **stays with the project** and is visible to anyone who opens it. External documents (SOPs, runbooks) can become stale, get lost, or diverge from the actual configuration. In-platform documentation is the most durable and discoverable form.
</Accordion>

***

You're now ready to finalize your project in the [Module 6 Exercise: Prepare for Production Deployment](/accounting-academy/module-6/6-exercise-production-deployment).
