Core Purpose
- Execution Tracking: Records each run of an import processor
- Status Management: Tracks progress from pending to completed/failed
- Audit Trail: Links imports to users and organizations
- Error Handling: Stores error messages when imports fail
Entity Structure
Import Lifecycle
1. Creation: Import record created when user initiates an import 2. Processing: Status changes to “processing” during execution 3. Completion: Status becomes “completed” with processedAt timestamp 4. Failure: Status becomes “failed” with error message storedStatus Values
| Status | Description |
|---|---|
pending | Import created but not yet started |
processing | Currently processing rows |
completed | Successfully finished |
failed | Encountered an error |
Relationships
ImportDefinition: Each Import uses one ImportDefinition for transformation rules User: Tracks which user initiated the import Organization: Scopes the import to an organization ImportResult: One Import can have many ImportResult records (one per site/period)Row Count
TherowCount field stores the total number of rows in the source file before processing. This helps track:
- How much data was provided
- Progress during processing
- Comparison with actual results produced
Error Handling
When an import fails, the error field contains details:- Missing required columns
- Invalid data types
- Processor code errors
- Database constraint violations
Access Control
- Imports are scoped to organizations via RLS policies
- Users can only see imports from their current organization
- The executing user is recorded but doesn’t restrict access
Querying Imports
Recent imports for an organization:Related Entities
- ImportDefinition: Defines the transformation rules
- ImportResult: Per-site results from the import
- FormElementSubmission: Values created by the import

