# Eligibility Summary View

Eligibility metrics are primarily derived from the `registry_summary` section of the API response. This section contains registry-type specific statistics (e.g., for a farmer registry: land holding mean, quartiles; or for a student registry: enrollment counts).

The method `_compute_summary_lines` checks dictionary entries in `registry_summary` and when found, attributes `summary_type='eligibility'`. The “key” field is generated by taking the dictionary key, replacing underscores with spaces and title-casing, and appending the benefit code mnemonic when applicable. The “value” gets been formatted as either `'{:,}'.format(int(value))` for numbers, or `str(value)` for strings, and measurement units are appended if available.

### Storage & UI linkage

* Each eligibility line becomes a record in `g2p.api.summary.line` with `summary_type='eligibility'`.
* The wizard form renders these lines grouped by summary type so the user sees “Eligibility” section lines separately (if UI grouping is implemented).

### Customizing New Fields

To add new eligibility-fields (for example a new quartile or demographic statistic) without modifying the core summary logic:

1. Extend the API schema to include your new field under `registry_summary`. Keep in mind that the logic for calculation and handling of this new field must also be created in the extensions.
2. Add a corresponding field in your Odoo summary-model (e.g., inherit `g2p.api.summary.line` or the registry-specific summary model) via a custom module.
3. Because `_compute_summary_lines` dynamically creates summary lines for *all* keys in `registry_summary`, the new field will automatically surface in the UI — you only need to add proper formatting/units if needed.
4. If you want the new field to be tagged as “eligibility” (rather than “general” or “entitlement”), ensure it appears under the non-dictionary (scalar) section when processing `registry_summary`.
5. In your custom module’s manifest add only the model extension and any view tweaks; you don’t modify `_compute_summary_lines`. This preserves upgrade-safety of the core PBMS module.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openg2p.org/products/pbms/developer-zone/tech-guides/summary-view/eligibility-summary-view.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
