diff --git a/requirements/FR-008.md b/requirements/FR-008.md index 96d03df..74e4392 100644 --- a/requirements/FR-008.md +++ b/requirements/FR-008.md @@ -32,3 +32,30 @@ Exporting analysis results in multiple formats is essential for users who need t - The system should provide a user-friendly interface for configuring export options. - The export functionality should be accessible from relevant areas of the application (e.g., project dashboards, analysis results pages). - The system should log export activities for auditing and monitoring purposes. +- Import and export flows must share a consistent schema contract so that data exported from the platform can be re-imported without loss. + +## Import/Export Field Mapping + +The following table inventories the core project and scenario attributes that must participate in bulk import/export workflows. It also documents whether a field is required during import, how validation should behave, and any special handling notes for generated values. + +| Dataset | Field | Data Type | Required on Import | Validation & Normalization | Export Behaviour | +| -------- | ------------------ | ----------------- | ------------------ | -------------------------------------------------------------------------- | -------------------------------------------- | +| Project | `name` | string (≤255) | Yes | Must be unique (case-insensitive); trim whitespace. | Always include; acts as stable identifier. | +| Project | `location` | string (≤255) | No | Accept blank values; normalize to title case where practical. | Include when present; blank otherwise. | +| Project | `operation_type` | enum | Yes | Must map to `MiningOperationType`; allow human-friendly labels on import. | Export canonical enum value. | +| Project | `description` | text | No | Permit multiline text; strip dangerous markup. | Export full text. | +| Project | `created_at` | datetime (UTC) | No | Ignored on import; system assigns timestamp. | Export for audit purposes (read-only). | +| Project | `updated_at` | datetime (UTC) | No | Ignored on import; system manages. | Export for audit purposes (read-only). | +| Scenario | `project_name` | string (≤255) | Yes | Must resolve to an existing project `name`; case-insensitive lookup. | Export to maintain relationship context. | +| Scenario | `name` | string (≤255) | Yes | Unique per project; trim whitespace. | Always include. | +| Scenario | `status` | enum | Yes | Map to `ScenarioStatus`; accept friendly labels (`Draft`, `Active`, etc.). | Export canonical enum value. | +| Scenario | `start_date` | date (ISO 8601) | No | Validate ordering with `end_date` when provided. | Export ISO 8601 string or blank. | +| Scenario | `end_date` | date (ISO 8601) | No | Must be ≥ `start_date` when both present. | Export ISO 8601 string or blank. | +| Scenario | `discount_rate` | decimal (5,2) | No | Accept percentage string or decimal; normalize to decimal (0-100). | Export numeric percentage with two decimals. | +| Scenario | `currency` | string (ISO 4217) | No | Uppercase 3-letter ISO code; validate against supported list. | Export uppercase code. | +| Scenario | `primary_resource` | enum | No | Map to `ResourceType`; accept human-friendly names on import. | Export canonical enum value. | +| Scenario | `description` | text | No | Allow multiline text; strip dangerous markup. | Export full text. | +| Scenario | `created_at` | datetime (UTC) | No | Ignored on import; system assigns timestamp. | Export for audit purposes (read-only). | +| Scenario | `updated_at` | datetime (UTC) | No | Ignored on import; system manages. | Export for audit purposes (read-only). | + +Additional domain entities (financial inputs, simulation parameters, etc.) will be inventoried in subsequent iterations once their import/export scope is defined. This initial mapping focuses on the mandatory Project and Scenario records required to satisfy FR-008 and related reporting flows.