Functional Requirements Document — ESG End-to-End Evidence-to-Action
Version: 1.0
Date: 2026-07-29
Status: Proposed baseline
1. System outcome
The system shall implement one traceable record across field and portal:
CaptureSession → EvidenceItems → AcceptedRecord → Finding → NCR → SignedSubmission → DeliveryReceipt → PortalProjection → Report
Every object has a stable identifier. Links are explicit. AI-derived values do not overwrite source evidence.
The architecture shall keep AI assistance outside the authoritative compliance path. Transcription, vision observations, and structured summaries are draft artifacts; deterministic rules, signatures, submission acceptance, and NCR transitions remain model-free.
2. Core state models
2.1 Submission state
draft → ready-to-sign → signed-local → queued → sending → received
Error paths:
sending → failed → queuedreceived → returned-for-correction → revised → signed-local
The UI shall not collapse these states into a single “submitted” state.
2.2 NCR state
open → assigned → remediation-recorded → verified → closed-corrected
Alternate paths:
open|assigned → closed-not-a-non-conformanceclosed-* → reopened
2.3 AI artifact state
not-requested → processing → draft → accepted|edited|discarded|failed
3. Field application requirements
3.1 Today and entry
| ID | Requirement | Acceptance |
|---|---|---|
| FR-FLD-001 | The field app shall open on Today | Assigned and locally saved work is visible without navigation |
| FR-FLD-002 | The primary action shall be Capture/Continue | Only one dominant action is presented |
| FR-FLD-003 | The user shall be able to start Inspection, Issue/NCR, or Incident from a short chooser | Choice uses domain nouns and fits on one screen |
| FR-FLD-004 | The app shall show project, site, form, and connectivity before capture | Incorrect context can be changed without losing work |
3.2 Camera and pictures
| ID | Requirement | Acceptance |
|---|---|---|
| FR-CAP-001 | Capture shall support device camera and photo library | Both paths attach to the same draft |
| FR-CAP-002 | Each image shall retain original bytes or an approved evidentiary derivative | Hash, capture time, source, and uploader are stored |
| FR-CAP-003 | Location and address, when available and permitted, shall be bound to capture metadata | Missing location is explicit, not fabricated |
| FR-CAP-004 | The user shall preview, annotate with a caption, retake, or remove before commitment | Removing from a draft does not imply deletion of committed evidence |
| FR-CAP-005 | The system shall support multiple photos per finding | Order and captions persist |
| FR-CAP-006 | AI image analysis shall return draft observations only | Source photo remains visible beside the draft |
3.3 Voice and text
| ID | Requirement | Acceptance |
|---|---|---|
| FR-VOI-001 | Capture shall support tap-to-record with a visible recording state | Start, pause/stop, duration, and cancel are obvious |
| FR-VOI-002 | Audio shall be stored locally before transcription is attempted | Network or AI failure cannot lose the recording |
| FR-VOI-003 | The system shall produce a timestamped transcript when service is available | Transcript status and errors are visible |
| FR-VOI-004 | The user shall edit the transcript without altering the original audio | Both audio and accepted text remain attributable |
| FR-VOI-005 | Typed notes shall be available as an equal fallback | No voice permission or service is required |
| FR-VOI-006 | Domain vocabulary hints may improve transcription | Hints are project/template scoped and versioned |
3.4 AI draft and review
| ID | Requirement | Acceptance |
|---|---|---|
| FR-AI-001 | The system shall combine accepted transcript/text and selected images into a draft summary | Draft cites which evidence items informed it |
| FR-AI-002 | Structured extraction shall produce schema-validated draft fields | Invalid output is rejected, not partially committed |
| FR-AI-003 | The UI shall label generated content “AI draft” | Label remains until accepted or edited |
| FR-AI-004 | The user shall accept, edit, or discard each consequential draft | There is no automatic ticket, severity, or submission |
| FR-AI-005 | AI shall not infer missing time, location, identity, signature, or checklist coverage | Unknown remains unknown |
| FR-AI-006 | AI failure shall leave the manual workflow fully functional | User can proceed from the same screen |
| FR-AI-007 | Prompts, model identifier, output schema, and acceptance action shall be auditable | Portal history exposes provenance to authorized users |
3.5 Inspection and coverage
| ID | Requirement | Acceptance |
|---|---|---|
| FR-INS-001 | An inspection shall present sections in template order | Progress reflects answered/attested sections |
| FR-INS-002 | Checklist items shall support satisfactory, deficient, N/A, and unanswered | Unanswered is visually and semantically distinct |
| FR-INS-003 | Each section shall require explicit coverage attestation | Opening a section does not mark it covered |
| FR-INS-004 | A deficient item shall offer Capture finding as the next action | Context is prefilled |
| FR-INS-005 | A report preview shall reflect unanswered items honestly | No default-pass rendering |
3.6 Finding and ticket
| ID | Requirement | Acceptance |
|---|---|---|
| FR-NCR-001 | A finding shall have its own identifier and source links | Origin section, inspection, evidence, time, and reporter are visible |
| FR-NCR-002 | The user shall confirm whether a finding requires an NCR | Required business rules may preselect but not conceal the outcome |
| FR-NCR-003 | NCR creation shall prefill title, description, evidence, project, site, and origin | User need not re-enter captured facts |
| FR-NCR-004 | Priority, owner, and due date shall be visible before final creation or clearly marked for supervisor triage | No ownerless “complete” ticket |
| FR-NCR-005 | Ticket events shall be append-only and idempotent | Retry does not duplicate the ticket |
| FR-NCR-006 | Closure as corrected shall require remediation evidence and verification | State transition is enforced server-side |
3.7 Review, signature, submit, and receipt
| ID | Requirement | Acceptance |
|---|---|---|
| FR-SUB-001 | Review shall summarize missing requirements, evidence, findings, and tickets | User can jump directly to an incomplete item |
| FR-SUB-002 | Signature shall record signer, role, time, and signature method | Consent text is visible before signing |
| FR-SUB-003 | Submit shall first create a durable signed-local record | App can close safely after the action |
| FR-SUB-004 | Sync shall use an idempotency key per submission revision | Repeat delivery yields one portal record |
| FR-SUB-005 | The app shall show Queued, Sending, Received, or Failed | State persists across restart |
| FR-SUB-006 | Received shall include server receipt ID and timestamp | Receipt can be copied and reconciled in portal |
| FR-SUB-007 | Failed delivery shall show a plain-language reason and Retry | Draft/evidence remains available |
4. Portal requirements
4.1 Information architecture
The portal shall expose four primary destinations:
- Overview — operational attention and recent receipts.
- Submissions — inspections, audits, and incidents in one filterable inbox.
- Issues — NCR and corrective-action work.
- Register — obligations, permits, and compliance reference data.
Administration is a role-gated utility, not primary navigation.
4.2 Submissions inbox
| ID | Requirement | Acceptance |
|---|---|---|
| FR-POR-001 | The inbox shall show received submissions by default | New field receipt appears without manual data seeding |
| FR-POR-002 | Filters shall include process, project/site, date, status, submitter, and open-issue state | Filters are shareable in the URL |
| FR-POR-003 | Each row shall show process, site, submitter, received time, report state, and ticket count | Status can be understood without opening |
| FR-POR-004 | Demo records shall carry a persistent Demo label | Demo and live records cannot be confused |
4.3 Submission detail
| ID | Requirement | Acceptance |
|---|---|---|
| FR-POR-010 | Detail shall have a clear summary header and one current status | ID and receipt are copyable |
| FR-POR-011 | Detail shall group Overview, Evidence, Findings & tickets, Activity, and Report | Tabs or anchored sections preserve context |
| FR-POR-012 | Evidence shall support photo view, audio playback, transcript, metadata, and provenance | Original and accepted text are distinguishable |
| FR-POR-013 | AI drafts and accepted values shall be distinguishable in history | Reviewer can see who accepted or edited output |
| FR-POR-014 | Linked NCRs shall open without losing the submission context | Back navigation returns to the same section |
| FR-POR-015 | The report shall be previewable and downloadable | File version and generation time are shown |
4.4 Issues
| ID | Requirement | Acceptance |
|---|---|---|
| FR-POR-020 | Issues shall provide an NCR inbox grouped by attention | Overdue, unassigned, awaiting verification, and recently closed are distinct |
| FR-POR-021 | Ticket detail shall show owner, due date, state, evidence, origin, and full history | No lifecycle fact exists only in a hidden audit log |
| FR-POR-022 | Assignment, remediation, verification, closure, and reopen shall enforce role and transition rules | Invalid transition is rejected with explanation |
5. Report requirements
| ID | Requirement |
|---|---|
| FR-RPT-001 | Inspection reports shall follow the golden section order and stable form identity |
| FR-RPT-002 | Reports shall include checklist outcomes, notes, embedded photos, signatures, page numbering, and required evidence metadata |
| FR-RPT-003 | Unanswered and not-recorded states shall print explicitly |
| FR-RPT-004 | Reports shall link to the source submission/revision and list report generation time |
| FR-RPT-005 | On-device preview and server-generated output shall be structurally equivalent |
| FR-RPT-006 | A report generation failure shall not change submission receipt state |
6. Integration and API requirements
| ID | Requirement |
|---|---|
| FR-INT-001 | A field-specific authentication mechanism shall mint short-lived ingest credentials without embedding server secrets |
| FR-INT-002 | Media upload shall support resumable or retry-safe delivery |
| FR-INT-002A | Event reconciliation and media transfer shall expose separate progress/failure states while sharing the submission idempotency boundary |
| FR-INT-003 | Ingest shall validate schema version, tenant, project, actor, hash, and idempotency key |
| FR-INT-004 | Accepted events shall project into submissions, evidence, ticket, and report read models |
| FR-INT-005 | The receipt response shall be durable and queryable by field submission ID |
| FR-INT-006 | Sync conflicts shall preserve both versions and require explicit resolution when automatic reconciliation is unsafe |
| FR-INT-007 | Observability shall correlate device record, request, event, projection, ticket, and report IDs |
| FR-INT-008 | A versioned wire contract shall be compatibility-tested on field and server even when each runtime keeps a local implementation |
7. OpenAI-assisted processing
The recommended pattern is asynchronous, reviewable assistance rather than an always-on conversational layer:
- store audio/photo locally;
- transcribe audio;
- analyze selected images and accepted text;
- request schema-constrained draft fields and summary;
- validate output;
- show the draft beside its sources;
- commit only the user-accepted result.
Current official OpenAI documentation supports image inputs in the Responses API, transcription models for audio, and structured model outputs. Realtime voice is available, but the core workflow shall not depend on a persistent realtime connection. Model selection is configuration, not a business requirement; production shall use an approved current model and a tested fallback.
8. Security, privacy, and governance
- Enforce tenant and project scoping on every read and write.
- Encrypt media and records in transit and at rest.
- Use least-privilege service credentials and short-lived device credentials.
- Record consent for audio, location, signature, and AI processing as required.
- Apply retention and legal-hold policy by artifact type.
- Never include secrets or unrelated personal data in model input.
- Define whether API data may be processed regionally before production.
- Maintain audit events for access, export, acceptance, correction, and deletion.
- Redact sensitive display fields by role while preserving authorized evidence.
9. Non-functional requirements
| Area | Requirement |
|---|---|
| Offline | Full capture, review, signature, report preview, and queueing without network |
| Performance | Field screens interactive within 1 second after local load; portal detail useful within 2 seconds at p75 |
| Durability | No acknowledged local action is lost across crash or restart |
| Accessibility | WCAG 2.2 AA target; keyboard, screen reader, focus, contrast, reduced motion |
| Field ergonomics | 56 pt primary targets; 44 pt minimum secondary targets; daylight contrast; glove testing |
| Reliability | Retry-safe sync and deterministic state rebuild from accepted events |
| Observability | User-facing receipt plus operational traces and dead-letter visibility |
| Compatibility | Supported modern portal browsers and approved iOS/Android devices |
10. Golden-journey acceptance test
Given an assigned inspection and an intermittently connected phone:
- start the inspection;
- explicitly attest one satisfactory section;
- mark one item deficient;
- record a voice note and attach two photos;
- view transcript and AI draft;
- edit the draft and accept it;
- create a prefilled NCR;
- sign while offline;
- observe Queued;
- restore connectivity and observe Received with receipt;
- find that receipt in the portal;
- play audio, view images and metadata, inspect the accepted text and AI provenance;
- open the linked NCR;
- preview and download the report.
The test fails if any step uses seeded portal data, hidden developer intervention, or a manual database change.