Files
famlaw/activeblue_familylaw/CLAUDE.md

231 lines
9.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md — activeblue_familylaw
This file gives Claude Code the context it needs to work effectively on this project.
Read this before making any changes.
---
## What This Is
**ActiveBlue Family Law** (`activeblue_familylaw`) is a custom Odoo 18 Community module for
Florida family law case management targeting **pro se litigants** in Miami-Dade County (11th Circuit).
Repo: `https://git.activeblue.net/tocmo0nlord/famlaw`
Module root: `activeblue_familylaw/`
Author: Active Blue LLC — `https://avc.activeblue.net`
Odoo version: **18.0**
License: LGPL-3
---
## Deployment Context
| Item | Value |
|---|---|
| Odoo instance | `odoo.activeblue.net` (Docker, multi-tenant) |
| Target database | `avc` (accessed via `avc.activeblue.net`) |
| Odoo version | 18.0 Community |
| AI inference | Ollama at `192.168.2.9:11434` |
| Reverse proxy | Traefik on CT 112 (`192.168.1.53`) |
| Git remote | `https://git.activeblue.net/tocmo0nlord/famlaw` |
---
## Module Structure
```
activeblue_familylaw/
├── __manifest__.py
├── __init__.py
├── models/
│ ├── fl_ai_engine.py ← Ollama-powered case analysis
│ ├── fl_analysis.py ← AI analysis records
│ ├── fl_argument.py ← Legal argument tracking
│ ├── fl_case.py ← Core case model (fl.case)
│ ├── fl_caselaw.py ← FL case law library
│ ├── fl_child.py ← Minor children records
│ ├── fl_deadline.py ← Procedural deadline tracking
│ ├── fl_deposition.py ← Deposition scheduling
│ ├── fl_discovery.py ← Discovery requests/responses
│ ├── fl_document.py ← Court document management
│ ├── fl_expense_case.py ← Case-linked expense tracking
│ ├── fl_fee_waiver.py ← Fee waiver eligibility
│ ├── fl_hearing.py ← Hearing calendar integration
│ ├── fl_income_withholding.py ← Income withholding orders
│ ├── fl_party.py ← Petitioner/Respondent parties
│ ├── fl_statute.py ← FL statute reference index
│ └── fl_support.py ← FL 61.30 child support calc
├── wizard/
│ ├── fl_intake_wizard.py ← Guided case creation
│ ├── fl_analysis_wizard.py ← Trigger AI analysis
│ ├── fl_generate_packet_wizard.py ← Generate filing packet
│ └── fl_discovery_suggest_wizard.py ← Complexity-driven discovery suggestions
├── views/
│ ├── fl_case_views.xml
│ ├── fl_discovery_suggest_views.xml
│ ├── menu_views.xml
│ ├── portal_*.xml ← Client-facing portal templates
│ └── website_intake_templates.xml
├── report/ ← 12 QWeb PDF court documents
│ ├── report_financial_affidavit_short.xml ← FL-12.902(b)
│ ├── report_financial_affidavit_long.xml ← FL-12.902(c)
│ ├── report_child_support_worksheet.xml ← FL-12.902(e)
│ ├── report_motion_to_modify.xml
│ ├── report_notice_deposition.xml
│ ├── report_motion_to_compel.xml
│ ├── report_income_withholding.xml
│ ├── report_fee_waiver.xml
│ ├── report_notice_ssn.xml ← FL-12.930(a)
│ ├── report_mandatory_disclosure.xml ← FL-12.932
│ ├── report_default_motion.xml
│ └── report_parenting_plan.xml
├── data/
│ ├── fl_support_schedule.xml ← Basic Support Obligation table
│ ├── fl_statute_data.xml ← FL statute index seeds
│ ├── fl_caselaw_data.xml ← 23 pre-loaded FL cases
│ ├── fl_deadline_rules.xml ← Procedural deadline rules
│ ├── fl_issue_tags.xml ← Issue taxonomy
│ ├── ir_sequence.xml ← Case number sequences
│ ├── mail_templates.xml
│ └── case_task_templates.xml
├── security/
│ ├── fl_security.xml
│ └── ir.model.access.csv
├── controllers/ ← Portal + website intake routes
└── static/src/
├── css/familylaw_portal.css
└── js/
├── fl_calculator.js ← Interactive FL 61.30 widget
└── fl_timeline.js ← Visual case timeline
```
---
## Core Domain Models
All models use the `fl.` prefix.
| Model | Description |
|---|---|
| `fl.case` | Root entity — case type, parties, status, AI complexity score |
| `fl.party` | Petitioner or Respondent (links to `res.partner`) |
| `fl.child` | Minor children on the case |
| `fl.support` | FL 61.30 child support calculation |
| `fl.deadline` | Procedural deadlines with calendar sync |
| `fl.hearing` | Scheduled hearings |
| `fl.discovery` | Individual discovery requests/responses |
| `fl.discovery.suggest.wizard` | Complexity-driven discovery suggestion engine |
| `fl.discovery.suggest.line` | One suggested discovery item |
| `fl.deposition` | Deposition scheduling and tracking |
| `fl.document` | Court-filed documents (linked to reports) |
| `fl.analysis` | AI case analysis records |
| `fl.caselaw` | Florida case law library entries |
| `fl.statute` | FL statute reference index |
| `fl.fee.waiver` | Fee waiver eligibility and form data |
| `fl.income.withholding` | Income withholding order records |
| `fl.argument` | Legal argument tracking (linked to case law) |
### Key Fields on `fl.case`
- `case_type`: `modification` | `dissolution` | `paternity`
- `complexity`: `low` | `medium` | `high` | `extreme` (set by AI engine or rule-based fallback)
- `issue_tag_ids`: Many2many `fl.issue.tag` — used by AI engine and discovery suggestion wizard
- `domestic_violence_flag`, `respondent_has_counsel`, `income_imputation_concern`: boolean flags
that affect discovery templates
---
## AI Engine
`fl_ai_engine.py` calls **Ollama** for case analysis.
- Ollama endpoint: `http://192.168.2.9:11434`
- Used for: complexity scoring, case law relevance, argument generation
- Rule-based fallback when Ollama is unavailable
- Analysis results stored in `fl.analysis` records
- AI tab on `fl.case` form shows current analysis + trigger button
The discovery suggestion wizard (`fl_discovery_suggest_wizard.py`) reads AI complexity or falls
back to rule-based logic. It has 50+ templates across 10 trigger categories:
`base`, `modification`, `dissolution`, `paternity`, `alimony`, `custody`,
`imputation` (Barner v. Barner), `self_employment`, `domestic_violence`,
`respondent_counsel`, `complex_only`.
---
## Odoo Dependencies
Declared in `__manifest__.py`:
```python
'depends': [
'base', 'mail', 'portal', 'website',
'contacts', 'calendar', 'project',
'crm', 'account', 'hr_expense',
# 'sign' — enable when confirmed installed
# 'queue_job' — OCA, install separately if needed
]
```
`sign` and `queue_job` are commented out intentionally — do not add them back without
confirming they're installed on the target instance.
---
## Development Conventions
### Odoo 18 Patterns
- Use `fields.Html` for rich text, `fields.Text` for plain
- `@api.depends` for computed fields; always set `store=True` if used in search/group
- Use `_inherit` not `_name` for extending existing Odoo models
- All new models need entries in `ir.model.access.csv` AND `fl_security.xml`
- XML IDs must be unique across the module — prefix everything with `fl_`
### Views
- Actions must be declared before `<menuitem>` references in `menu_views.xml`
- Portal templates go in `views/portal_*.xml`
- Website intake templates go in `views/website_intake_templates.xml`
- Always test QWeb reports with `wkhtmltopdf` — paper sizes matter for court forms
### Discovery Suggest Wizard
- Add new discovery templates to the `_get_templates()` method in `fl_discovery_suggest_wizard.py`
- Each template has: `type`, `directed_to`, `description`, `rationale`, `trigger`, `min_complexity`
- Triggers are string labels — keep them consistent with existing ones
- `action_create_selected` posts a chatter summary — keep it
### AI Engine
- Always handle `requests.exceptions.ConnectionError` from Ollama gracefully
- Use the rule-based fallback when Ollama is down — never let AI failures block user workflow
- Log AI calls to chatter on `fl.case` for auditability
### Reports (QWeb)
- Court form dimensions: US Letter (8.5×11 in) — set `paperformat_id` appropriately
- Florida court forms reference: FL Supreme Court forms at `www.flcourts.gov`
- Field labels must match the official form labels exactly
---
## Out of Scope for This Repo
- Odoo AI agent / Master AI system → `tocmo0nlord/odoo-ai` (separate repo)
- IRC bot → `tocmo0nlord/irc-bot`
- Traefik / infrastructure config → CT 112 directly
- HIPAA training eLearning module → different Odoo addon
---
## Running / Testing
```bash
# Restart Odoo to pick up module changes
docker compose restart odoo
# Update module (from Odoo container or Settings → Apps)
# Technical → Update Apps List first if adding new files
# Check logs
docker compose logs -f odoo | grep activeblue_familylaw
```
Module installs via **Apps → Upload a Module** or by placing it in the addons path.
After any model change: **Settings → Activate Developer Mode → Technical → Update Apps List → Upgrade**.