This project manages student transition data for NAHS (Alternative High School) students. The system loads data from multiple Google Sheets, processes it with enhanced duplicate detection and data precedence logic, and writes consolidated information to a TENTATIVE-Version2 sheet.
π― System Status: Production-ready with enhanced teacher input processing and comprehensive duplicate detection capabilities.
- Intelligent Teacher Grouping: Automatically identifies and groups duplicate teacher submissions
- Timestamp-Based Resolution: Selects most recent teacher responses based on submission timestamps
- Smart Data Precedence: Form responses take priority over tentative data with intelligent fallback
- Production-Ready Architecture: Clean, optimized code without debugging artifacts
- Multi-Source Integration: Combines data from 8+ different Google Sheets
- Column F Student ID Extraction: Optimized for cleaned sheet structure
- Source Data Compatibility: Handles eligibility field mapping with proper source spelling
- Comprehensive Validation: Ensures data integrity across all processing stages
src/
βββ config/ # Configuration files
β βββ constants.js # System constants and sheet names
β βββ sheetConfigs.js # Sheet configuration mappings
βββ data-loaders/ # Data loading classes
β βββ baseDataLoader.js # Base class for loading sheet data
βββ data-processors/ # Data processing logic
βββ writers/ # Sheet writing functionality
βββ utils/ # Utility functions
β βββ dateUtils.js # Date manipulation functions
β βββ dataUtils.js # Data validation and processing
βββ services/ # Business logic services
βββ main.js # Main entry point
tests/
βββ unit/ # Unit tests
βββ integration/ # Integration tests
legacy/ (old files at root level)
- Duplicate Detection: Automatically identifies multiple teacher submissions per student
- Timestamp Analysis: Intelligently selects most recent responses based on submission timestamps
- Data Precedence Logic: Form responses override tentative data with intelligent fallback
- Email Integration: Sophisticated teacher email mapping and validation
- FormResponsesDataLoader: Column F student ID extraction with optimized sheet processing
- StudentDataMerger: Smart data precedence with comprehensive conflict resolution
- TentativeRowBuilder: Production-ready row assembly with source data compatibility
- Multi-Source Integration: Seamlessly combines data from 8+ Google Sheets
- Validation Framework: Comprehensive data integrity checks at every stage
- Error Resilience: Graceful handling of missing data and processing errors
- Performance Optimization: Efficient Map operations for large datasets
- Load Data Sources: Import from all Google Sheets with optimized loaders
- Detect Duplicates: Identify and group duplicate teacher submissions
- Apply Precedence: Form responses take priority over tentative data
- Merge & Validate: Combine all sources with comprehensive validation
- Build Output: Assemble final rows with calculated fields and formatting
- Write Results: Update TENTATIVE-Version2 sheet with processed data
- Duplicate Teacher Detection: Intelligent handling of multiple teacher submissions
- Smart Data Precedence: Form responses override tentative data appropriately
- Column F Optimization: Streamlined student ID extraction from cleaned sheets
- Source Data Compatibility: Proper handling of eligibility field spelling constraints
- Production Architecture: Clean, optimized code without debugging artifacts
- Comprehensive JSDoc: Fully documented system with examples and usage guides
- Error Handling: Robust error management with graceful degradation
- Data Validation: Multi-level validation ensures data integrity
- Backward Compatibility: Maintains compatibility with existing workflows
- Performance Optimization: Efficient processing for large datasets
- Clean Architecture: Modular design with clear separation of concerns
// Call this function to run the complete data processing
loadTENTATIVEVersion2();All configuration is centralized in src/config/:
- Sheet names and IDs
- Column mappings
- Teacher email mappings
- System settings
The new structure uses a base class pattern with specific loaders:
// Using individual loaders
const tentativeLoader = new TentativeDataLoader();
const tentativeData = tentativeLoader.loadData();
const registrationLoader = new RegistrationDataLoader();
const registrationData = registrationLoader.loadData();
// Or load all data at once
const allData = loadAllStudentDataWithLoaders();
// Backward compatible functions still work
const scheduleData = schedulesSheet(); // Still works
const contactData = loadContactData(); // Still works- Created folder structure
- Added configuration files
- Created utility functions
- Added base data loader class
- Created main entry point
- Implemented all specific data loader classes
- Created backward-compatible functions
- Updated main.js to use new data loaders
- Implemented data processor classes
- Created validation utilities
- Built comprehensive processing pipeline
- Broke down the 701-line writeToTENTATIVEVersion2Sheet function
- Implemented modular sheet writer classes
- Created backward compatibility layer
- Add comprehensive error handling and logging
- Create comprehensive unit tests
- Add JSDoc documentation
- Add unit tests for all functions
- Create integration tests
- Add JSDoc documentation
- Remove legacy version1scripts folder
- Add logging system
- Create deployment guide
- Move constants to
src/config/constants.js - Create sheet configurations
- Extract date functions to
src/utils/dateUtils.js - Extract data functions to
src/utils/dataUtils.js
-
loadTentativeData.jsβsrc/data-loaders/tentativeDataLoader.js -
loadRegistrationsData.jsβsrc/data-loaders/registrationDataLoader.js -
loadSchedules.jsβsrc/data-loaders/scheduleDataLoader.js -
loadContactData.jsβsrc/data-loaders/contactDataLoader.js -
loadEntryWithdrawalData.jsβsrc/data-loaders/entryWithdrawalDataLoader.js -
loadFormResponses1Data.jsβsrc/data-loaders/formResponsesDataLoader.js -
loadWithdrawnData.jsβsrc/data-loaders/withdrawnDataLoader.js -
loadWDOther.jsβsrc/data-loaders/wdOtherDataLoader.js -
loadStudentAttendanceData.jsβsrc/data-loaders/attendanceDataLoader.js - Created
src/data-loaders/index.jsfor centralized access
- Extract processing logic from main functions
- Create testable, single-purpose processors
-
StudentDataMerger- Handles complex data merging operations -
StudentFilterProcessor- Manages student filtering logic -
ScheduleProcessor- Processes course and schedule data -
TeacherInputProcessor- Handles form response processing - Created validation utilities for data integrity
-
writeToTENTATIVEVersion2.jsβsrc/writers/tentativeSheetWriter.js -
BaseSheetWriter- Common functionality for all sheet writers -
TentativeRowBuilder- Builds individual student data rows -
TentativeSheetWriter- Handles complete sheet writing process -
SheetWriterFactory- Manages writer instances - Broke down 701-line function into manageable classes
- Added comprehensive error handling and recovery
- Created backward compatibility layer
Located in tests/unit/. Test individual functions and classes.
Located in tests/integration/. Test complete workflows.
// Run from Google Apps Script editor
doGet(); // Runs QUnit testsWhen adding new functionality:
- Follow the established folder structure
- Use the constants from
src/config/constants.js - Add appropriate error handling
- Write unit tests for new functions
- Update this README with changes
Contact: Alvaro Gomez (alvaro.gomez@nisd.net) Office: +1-210-397-9408 Mobile: +1-210-363-1577