-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
Description
Overview
Add model layer functions to query CFACTS data and compare with ZTMF systems. This provides the data logic layer for the API endpoints.
Parent Epic: #233
Customer Value
Backend can find discrepancies between SDL CFACTS data and ZTMF systems programmatically.
Scope
Create backend/internal/model/cfacts.go with:
Functions to Implement
-
FindCFACTSSystems() - Query cfacts_systems table with filters
- Support filters: is_active, is_retired, is_decommissioned
- Pagination support
- Return CFACTS system data
-
CompareWithZTMF() - JOIN query to find matches/mismatches
- FULL OUTER JOIN: fismasystems ↔ cfacts_systems
- Match on fisma_uuid = fismauid
- Return side-by-side comparison
-
FindDiscrepancies() - Categorize data quality issues
- Systems in CFACTS but missing from ZTMF
- Systems in ZTMF but missing from CFACTS
- ISSO email mismatches
- Decommission status conflicts
- Return categorized discrepancy list
Patterns to Follow
- Reuse patterns from
fismasystems.go - Use squirrel query builder
- Use pgx for database access
- Consistent error handling
Acceptance Criteria
- Model file created:
backend/internal/model/cfacts.go - All 3 query functions implemented
- Unit tests for each function
- Test coverage > 80%
- Works with test data:
_test_data_cfacts_empire.sql - Code comments document each function
- Follows existing codebase patterns
Testing
# Run unit tests
make test-unit
# Run with coverage
make test-coverageSize Estimate
Small (1-2 days)
Dependencies
- Table exists (Issue #XXX completed)
- Test data exists (PR Stage 1: Add cfacts_systems table for SDL CFACTS sync #240)
Blocks
- Issue #XXX (API endpoints need this model layer)
Related
- Parent: [Epic] Sync FISMA system data from SDL CFACTS tables #233 (SDL/CFACTS Sync Epic)
- Depends on: Database table (already complete)
- Blocks: API endpoints
Reactions are currently unavailable