đ ImportExportServices Documentation
đ QUICK DOCUMENTATIONâ
- File Path: Services in
/Infrastructure/Services/ImportExport/*and interfaces in/Application/Common/Interfaces/IImport*and/Application/Common/Interfaces/IExport* - Primary Purpose: Provides services for importing and exporting assets, components, and related data between Asset Valuer Pro and external systems
- Key Methods:
ImportAssetRegister(): Processes asset register spreadsheetsExportAssetRegister(): Exports asset data to spreadsheetsImportFieldData(): Imports data collected from mobile devicesImportImages(): Processes asset imagesValidateImportData(): Validates data against business rules
- Used By:
ImportController: For import operationsAssetController: For asset export operationsJobController: For job-related exports- Import/Export command and query handlers
- Related Models:
Asset: Assets being imported/exportedComponent: Components being imported/exportedImportLog: Log entries for import operationsImportValidationResult: Validation results for imports
đī¸ DETAILED DOCUMENTATIONâ
đī¸ Overviewâ
The ImportExportServices provide a comprehensive set of services for transferring data between Asset Valuer Pro and external systems. These services handle importing asset data from client systems, field data from mobile collection apps, and exporting data for reporting and analysis. The services include robust validation, error handling, and logging to ensure data integrity during transfer operations.
đ§ Service Detailsâ
- Namespace: AVP.Infrastructure.Services.ImportExport
- Pattern: Service implementations of domain interfaces
- Dependencies:
ExcelService: Handles Excel file processingFileStorageService: Manages file storage operationsValidationService: Validates data against business rules
đ Import Servicesâ
âī¸ AssetImportServiceâ
- Purpose: Imports asset data from Excel/CSV spreadsheets
- Key Methods:
ImportAssetRegister(file): Imports a complete asset registerParseAssetData(data): Converts raw data to asset entitiesValidateAssetImport(assets): Validates imported asset dataProcessImportResults(results): Handles import results
âī¸ FieldDataImportServiceâ
- Purpose: Processes data collected via mobile app
- Key Methods:
ImportFieldData(data): Imports field collection dataMergeFieldData(existingData, newData): Merges field data with existing recordsSynchronizeOfflineData(offlineData): Handles offline data reconciliationProcessFieldUpdates(updates): Applies field updates to assets
âī¸ ImageImportServiceâ
- Purpose: Imports and associates images with assets
- Key Methods:
ImportImages(files): Processes image filesCreateThumbnails(images): Generates thumbnail versionsAssociateImagesWithAssets(images, assets): Links images to appropriate assetsSetPrimaryImage(asset, image): Sets primary image for an asset
đ Export Servicesâ
đ AssetExportServiceâ
- Purpose: Exports asset data to spreadsheets
- Key Methods:
ExportAssetRegister(criteria): Exports asset data based on criteriaConfigureExportColumns(options): Configures export column selectionGenerateExcelFile(data): Creates Excel output filesGenerateCsvFile(data): Creates CSV output files
đ ImageExportServiceâ
- Purpose: Exports asset images
- Key Methods:
ExportImages(assetIds): Exports images for selected assetsCreateImageZipFile(images): Creates downloadable zip archivesGenerateImageMetadata(images): Creates metadata files for exports
đ Validation Servicesâ
â ī¸ ImportValidationServiceâ
- Purpose: Validates imported data against business rules
- Key Methods:
ValidateAssetData(assets): Validates asset data completeness and correctnessValidateComponentData(components): Validates component dataValidateRelationships(assets, components): Validates entity relationshipsGenerateValidationReport(results): Creates validation summary reports
đ Import/Export Process Flowâ
đ Import Flowâ
- File Upload: User uploads spreadsheet or mobile app syncs data
- Pre-processing:
- File format detection and validation
- Basic structure validation
- Data Parsing:
- Convert raw data to entity structures
- Map external field names to internal properties
- Business Validation:
- Validate required fields
- Check data types and constraints
- Validate relationships and dependencies
- Processing:
- Create new records or update existing ones
- Apply business rules and defaults
- Results:
- Generate import result summary
- Create detailed logs for review
- Return success/failure to user
đ Export Flowâ
- Request Parameters:
- User specifies export criteria and options
- System validates request parameters
- Data Retrieval:
- Query database for requested entities
- Include related data as needed
- Data Transformation:
- Format data for target output format
- Apply formatting and calculations
- File Generation:
- Create Excel, CSV, or ZIP files
- Apply consistent formatting
- Delivery:
- Return file for download
- Store file in file system if requested
đ Business Contextâ
đ Critical Role in Valuation Workflowâ
According to the legacy documentation, import/export functionality is fundamental to the Asset Valuer Pro workflow:
"An initial asset register and associated attributes are sourced from the client and imported into Asset Valuer Pro via Excel"
The ImportExportServices implement this core business requirement, enabling the data acquisition that begins the valuation process.
đ Field Data Collection Processâ
The legacy documentation describes a specific workflow for field data collection:
"All data held within Asset Valuer Pro is exported to CSV files and zip files (images) and imported into File Maker Pro running off the valuers PC. This is then synchronised to the iPad. On return to the office (or web access) the data is then synchronised back to the PC, exported and then imported back into Asset Valuer Pro."
The FieldDataImportService and export services implement this workflow, handling the transfer of data between the core system and mobile collection devices.
đ Client Data Integrationâ
For infrastructure assets, the documentation notes:
"For infrastructure, the data is normally provided by the client in Excel files. The valuers will then clean up and sort the Excel files and import the data into Asset Valuer Pro."
The ImportExportServices include functionality specifically for handling and processing client-provided Excel files, with validation to ensure data quality.
đ Format Support Requirementsâ
The legacy documentation specifies format requirements:
"All textual data can be imported and exported via Excel (version 2) or CSV file (version 3)... A separate process using zip files is used to import/export photos and images."
The services implement these exact format requirements, supporting both Excel and CSV for textual data and zip files for images.
⥠Performance Considerationsâ
When working with large datasets:
-
Batch Processing
- Process large imports in smaller batches
- Use transactions for data integrity
-
Memory Management
- Stream large files rather than loading entirely in memory
- Release resources promptly after processing
-
Parallel Processing
- Process multiple files concurrently where appropriate
- Use background tasks for time-consuming operations
â ī¸ Common Issues and Solutionsâ
âšī¸ Note: Watch for these common import/export challenges:
-
Data Mapping Issues
- Field name mismatches
- Solution: Use flexible mapping with alias support
-
Character Encoding
- Special characters corrupted during transfer
- Solution: Enforce UTF-8 encoding
-
Image Handling
- Large images consuming excessive resources
- Solution: Automatic resizing and compression
-
Relationship Integrity
- References to non-existent entities
- Solution: Validation before database modification
đ§ Integration Pointsâ
The ImportExportServices integrate with several other components:
- File Storage: Stores and retrieves import/export files
- Validation Services: Validates data against business rules
- Logging Services: Records import/export activities
- Mobile App Interfaces: Communicates with field collection apps
- Authorization Services: Controls access to import/export operations