Files
claudetools/SESSION_NOTES-retrieved.md
Mike Swanson e4392afce9 docs: Document Dataforth test database system and troubleshooting
Investigation and Documentation:
- Discovered and documented test database system on AD2 server
- Created comprehensive TEST_DATABASE_ARCHITECTURE.md with full system details
- Retrieved all key database files from AD2 (import.js, schema.sql, server configs)
- Documented data flow: DOS machines → NAS → AD2 → SQLite → Web interface
- Verified database health: 1,027,517 records, 1075 MB, dates back to 1990

Database System Architecture:
- SQLite database with Node.js/Express.js web server (port 3000)
- Automated import via Sync-FromNAS.ps1 (runs every 15 minutes)
- 8 log types supported: DSCLOG, 5BLOG, 7BLOG, 8BLOG, PWRLOG, SCTLOG, VASLOG, SHT
- FTS5 full-text search, comprehensive indexes for performance
- API endpoints: search, stats, export, datasheet generation

Troubleshooting Scripts Created:
- Database diagnostics: check-db-simple.ps1, test-db-directly.ps1
- Server status checks: check-node-running.ps1, check-db-server.ps1
- Performance analysis: check-db-performance.ps1, check-wal-files.ps1
- API testing: test-api-endpoint.ps1, test-query.js
- Import monitoring: check-new-records.ps1
- Database optimization attempts: api-js-optimized.js, api-js-fixed.js
- Deployment scripts: deploy-db-optimization.ps1, deploy-db-fix.ps1, restore-original.ps1

Key Findings:
- Database file healthy and queryable (verified with test-query.js)
- Node.js server not running (port 3000 closed) - root cause of web interface issues
- Database last updated 8 days ago (01/13/2026) - automated sync may be broken
- Attempted performance optimizations (WAL mode) incompatible with readonly connections
- Original api.js restored from backup after optimization conflicts

Retrieved Documentation:
- QUICKSTART-retrieved.md: Quick start guide for database server
- SESSION_NOTES-retrieved.md: Complete session notes from database creation
- Sync-FromNAS-retrieved.ps1: Full sync script with database import logic
- import-js-retrieved.js: Node.js import script (12,774 bytes)
- schema-retrieved.sql: SQLite schema with FTS5 triggers
- server-js-retrieved.js: Express.js server configuration
- api-js-retrieved.js: API routes and endpoints
- package-retrieved.json: Node.js dependencies

Action Items Identified:
1. Start Node.js server on AD2 to restore web interface functionality
2. Investigate why automated sync hasn't updated database in 8 days
3. Check Windows Task Scheduler for Sync-FromNAS.ps1 scheduled task
4. Run manual import to catch up on 8 days of test data if needed

Technical Details:
- Database path: C:\Shares\testdatadb\database\testdata.db
- Web interface: http://192.168.0.6:3000 (when running)
- Database size: 1075.14 MB (1,127,362,560 bytes)
- Total records: 1,027,517 (slight variance from original 1,030,940)
- Pass rate: 99.82% (1,029,046 passed, 1,888 failed)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 16:38:54 -07:00

140 lines
4.8 KiB
Markdown

# Test Data Database - Session Notes
## Session Date: 2026-01-13
## Project Overview
Created a SQLite database with Express.js web interface to consolidate, deduplicate, and search test data from multiple backup dates and test stations.
## Project Location
`C:\Shares\TestDataDB\`
## Original Request
- Search for serial numbers 176923-1 through 176923-26 in model DSCA38-1793
- Serial numbers were NOT found in any existing .DAT files (most recent logged: 173672-x, 173681-x from Feb 2025)
- User requested a database to consolidate all test data for easier searching
## Data Sources
- **HISTLOGS**: `C:\Shares\test\Ate\HISTLOGS\` (consolidated history)
- **Recovery-TEST**: `C:\Shares\Recovery-TEST\` (6 backup dates: 12-13-25 to 12-18-25)
- **Live Data**: `C:\Shares\test\` (~540K files)
- **Test Stations**: TS-1L, TS-3R, TS-4L, TS-4R, TS-8R, TS-10L, TS-11L
## File Types Imported
| Log Type | Description | Extension |
|----------|-------------|-----------|
| DSCLOG | DSC product line | .DAT |
| 5BLOG | 5B product line | .DAT |
| 7BLOG | 7B product line (CSV format) | .DAT |
| 8BLOG | 8B product line | .DAT |
| PWRLOG | Power tests | .DAT |
| SCTLOG | SCT product line | .DAT |
| VASLOG | VAS tests | .DAT |
| SHT | Human-readable test sheets | .SHT |
## Project Structure
```
TestDataDB/
├── package.json # Node.js dependencies
├── server.js # Express.js server (port 3000)
├── database/
│ ├── schema.sql # SQLite schema with FTS
│ ├── testdata.db # SQLite database file
│ └── import.js # Data import script
├── parsers/
│ ├── multiline.js # Parser for multi-line DAT files
│ ├── csvline.js # Parser for 7BLOG CSV format
│ └── shtfile.js # Parser for SHT test sheets
├── public/
│ └── index.html # Web search interface
├── routes/
│ └── api.js # API endpoints
└── templates/
└── datasheet.js # Datasheet generator
```
## API Endpoints
- `GET /api/search?serial=...&model=...&from=...&to=...&result=...&q=...`
- `GET /api/record/:id`
- `GET /api/datasheet/:id` - Generate printable datasheet
- `GET /api/stats`
- `GET /api/export?format=csv`
## How to Use
### Start the server:
```bash
cd C:\Shares\TestDataDB
node server.js
```
Then open http://localhost:3000 in a browser.
### Re-run import (if needed):
```bash
cd C:\Shares\TestDataDB
node database/import.js
```
## Database Schema
- Table: `test_records`
- Columns: id, log_type, model_number, serial_number, test_date, test_station, overall_result, raw_data, source_file, import_date
- Indexes on: serial_number, model_number, test_date, overall_result
- Full-text search (FTS5) for searching raw_data
## Features
1. **Search** - By serial number, model number, date range, pass/fail status
2. **Full-text search** - Search within raw test data
3. **Export** - CSV export of search results
4. **Datasheet generation** - Generate formatted test data sheets from any record
5. **Statistics** - Dashboard showing total records, pass/fail counts, date range
## Import Status - COMPLETE
- Started: 2026-01-13T21:32:59.401Z
- Completed: 2026-01-13T22:02:42.187Z
- **Total records: 1,030,940**
### Import Details:
| Source | Records Imported |
|--------|------------------|
| HISTLOGS | 576,416 |
| Recovery-TEST/12-18-25 | 454,383 |
| Recovery-TEST/12-17-25 | 82 |
| Recovery-TEST/12-16 to 12-13 | 0 (duplicates) |
| test | 59 |
### By Log Type:
- 5BLOG: 425,378
- 7BLOG: 262,404
- DSCLOG: 181,160
- 8BLOG: 135,858
- PWRLOG: 12,374
- VASLOG: 10,327
- SCTLOG: 3,439
### By Result:
- PASS: 1,029,046
- FAIL: 1,888
- UNKNOWN: 6
## Current Status
- Server running at: http://localhost:3000
- Database file: `C:\Shares\TestDataDB\database\testdata.db`
## Known Issues
- Model number parsing needs re-import to fix (parser was updated but requires re-import)
- To re-import: Delete testdata.db and run `node database/import.js`
## Search Results for Original Request
- Serial numbers 176923-1 through 176923-26: **NOT FOUND** (not yet tested)
- Most recent serial for DSCA38-1793: 173672-x and 173681-x (February 2025)
## Next Steps
1. Re-run import if model number search is needed (delete testdata.db first)
2. When serial numbers 176923-1 to 176923-26 are tested, they will appear in the database
## Notes
- TXT datasheets in `10D/datasheets/` are NOT imported (can be generated from DB)
- Deduplication uses: (log_type, model_number, serial_number, test_date, test_station)
- ~3,600 SHT files to import
- ~41,000+ DAT files across all log types