Service Layer low complexity mobile
0
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Validates report field values against org-specific schema rules: required fields, value types, allowed options for checkbox/radio, and date format constraints. Returns structured errors per field so the UI can display non-colour-dependent messages per WCAG 2.2 AA.

Feature: Structured Post-Session Report

report-field-validator

Summaries

The Report Field Validator ensures that peer mentors submit complete, correctly formatted reports every time — directly protecting the quality of data coordinators rely on to track program outcomes. By catching errors at the point of entry rather than after submission, the organisation avoids costly manual review cycles, data correction efforts, and the reputational risk of acting on incomplete records. Accessibility compliance with WCAG 2.2 AA means the tool is usable by all staff regardless of visual ability, reducing legal exposure and broadening the talent pool for mentor recruitment. Clean, validated data also strengthens grant reporting and stakeholder communications, reinforcing trust with funders.

Report Field Validator is a self-contained mobile component with no external dependencies, making it one of the lowest-risk deliverables in the reporting feature set. Its low complexity means a single developer can implement and unit-test it within a short sprint. Because it has no async operations or network calls, test coverage is straightforward — pure input/output assertions cover all validation paths. The main scheduling consideration is ensuring the org-specific schema rules are finalised before implementation begins, as any late changes to required fields or allowed option sets will require validator updates and re-testing.

Coordinate with the UX team early to agree on error message copy so UI integration is seamless on first pass.

Report Field Validator is a pure, synchronous validation module running in the mobile execution context with zero external dependencies. Its four public interfaces — validateField(fieldConfig, value), validateForm(schema, values), getFieldErrors(fieldId), and isFormValid(schema, values) — follow a schema-driven design: field configuration objects describe type, required status, and allowed options, allowing the validator to remain generic while supporting org-specific rules. Each interface returns structured error objects keyed by fieldId, enabling the UI layer to render non-colour-dependent WCAG 2.2 AA compliant messages directly beside each input. The stateless architecture makes the component trivially testable and safe to call repeatedly on every keystroke or focus-out event without side effects or performance concerns.

Responsibilities

  • Validate required fields are non-empty
  • Check value types match field type (text, date, option set)
  • Validate checkbox/radio selections against allowed options
  • Return per-field validation error messages

Interfaces

validateField(fieldConfig, value)
validateForm(schema, values)
getFieldErrors(fieldId)
isFormValid(schema, values)

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/report-validation 6 endpoints
GET /api/v1/report-validation List available validation rule sets by org
GET /api/v1/report-validation/:fieldId/errors Get current validation errors for a specific field
POST /api/v1/report-validation/field Validate a single field value against its config
POST /api/v1/report-validation/form Validate an entire form (all fields) against a schema
PUT /api/v1/report-validation/:id Update a validation ruleset (reserved for schema evolution)
DELETE /api/v1/report-validation/:id Delete a validation ruleset