# Database Visual Overview ## πŸ“Š Database Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Government Travel Cost Estimator β”‚ β”‚ (Web Application) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ perDiem β”‚ β”‚accommodation β”‚ β”‚ Rates.json β”‚ β”‚ Rates.json β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ—‚οΈ Per Diem Database Structure ``` perDiemRates.json β”‚ β”œβ”€β”€ metadata β”‚ β”œβ”€β”€ effectiveDate: "2025-10-01" β”‚ β”œβ”€β”€ version: "1.0" β”‚ β”œβ”€β”€ lastUpdated: "2025-10-30" β”‚ └── source: "NJC Travel Directive" β”‚ β”œβ”€β”€ regions β”‚ β”‚ β”‚ β”œβ”€β”€ canada β”‚ β”‚ β”œβ”€β”€ meals β”‚ β”‚ β”‚ β”œβ”€β”€ breakfast (rate100: 29.05, rate75: 21.80, rate50: 14.55) β”‚ β”‚ β”‚ β”œβ”€β”€ lunch (rate100: 29.60, rate75: 22.20, rate50: 14.80) β”‚ β”‚ β”‚ └── dinner (rate100: 60.75, rate75: 45.55, rate50: 30.40) β”‚ β”‚ β”œβ”€β”€ incidentals (rate100: 17.30, rate75: 13.00) β”‚ β”‚ └── privateAccommodation (50.00/night) β”‚ β”‚ β”‚ β”œβ”€β”€ yukon (similar structure) β”‚ β”œβ”€β”€ nwt (similar structure) β”‚ β”œβ”€β”€ nunavut (similar structure) β”‚ β”œβ”€β”€ usa (similar structure) β”‚ β”œβ”€β”€ alaska (similar structure) β”‚ └── international (similar structure) β”‚ └── rateRules β”œβ”€β”€ day1to30: "rate100" β”œβ”€β”€ day31to120: "rate75" └── day121onward: "rate50" ``` ## 🏨 Accommodation Database Structure ``` accommodationRates.json β”‚ β”œβ”€β”€ metadata β”‚ β”œβ”€β”€ effectiveDate: "2025-10-30" β”‚ β”œβ”€β”€ version: "1.0" β”‚ └── source: "PWGSC Accommodation Directory" β”‚ β”œβ”€β”€ cities (Canadian & US) β”‚ β”œβ”€β”€ ottawa (standard: 165, max: 200, CAD) β”‚ β”œβ”€β”€ toronto (standard: 180, max: 220, CAD) β”‚ β”œβ”€β”€ vancouver (standard: 190, max: 240, CAD) β”‚ β”œβ”€β”€ newyork (standard: 250, max: 350, USD) β”‚ └── ... (30+ cities) β”‚ β”œβ”€β”€ internationalCities β”‚ β”œβ”€β”€ london (standard: 280, max: 380, CAD) β”‚ β”œβ”€β”€ paris (standard: 260, max: 350, CAD) β”‚ β”œβ”€β”€ tokyo (standard: 240, max: 340, CAD) β”‚ └── ... (8 cities) β”‚ └── defaults (by region) β”œβ”€β”€ canada (150/185 CAD) β”œβ”€β”€ usa (150/200 USD) β”œβ”€β”€ yukon (185/230 CAD) └── ... (7 regions) ``` ## πŸ”„ Data Flow Diagram ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ User Inputs β”‚ β”‚ - Departure β”‚ β”‚ - Destination β”‚ β”‚ - Dates β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ JavaScript β”‚ β”‚ - loadDatabases() β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Load perDiem β”‚ β”‚Load accom. β”‚ β”‚Database β”‚ β”‚Database β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Get Region β”‚ β”‚Find City β”‚ β”‚Rates β”‚ β”‚Rates β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Calculate Costs β”‚ β”‚- Meals β”‚ β”‚- Incidentals β”‚ β”‚- Accommodation β”‚ β”‚- Flight β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚Display Results β”‚ β”‚- Total Cost β”‚ β”‚- Breakdown β”‚ β”‚- Policy Links β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ“‹ Rate Lookup Logic ### Per Diem Lookup ``` User selects destination type: "canada" ↓ Look up: perDiemRatesDB.regions["canada"] ↓ Extract: β”œβ”€β”€ Breakfast: $29.05 β”œβ”€β”€ Lunch: $29.60 β”œβ”€β”€ Dinner: $60.75 └── Incidental: $17.30 ↓ Calculate: Daily Total = $136.70 ``` ### Accommodation Lookup ``` User enters city: "Toronto" ↓ Normalize: "toronto" (lowercase) ↓ Check: accommodationRatesDB.cities["toronto"] ↓ Found! Return: β”œβ”€β”€ Standard Rate: $180 β”œβ”€β”€ Max Rate: $220 └── Suggestion: "Toronto, ON: $180-$220 CAD" ↓ If NOT found β†’ Use regional default ``` ## 🎯 Rate Tiers Visual ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Extended Stay Rate Tiers β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ Days 1-30 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100% (rate100) β”‚ β”‚ Full meal allowance β”‚ β”‚ β”‚ β”‚ Days 31-120 β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 75% (rate75) β”‚ β”‚ Reduced meal allowance β”‚ β”‚ β”‚ β”‚ Days 121+ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 50% (rate50) β”‚ β”‚ Further reduced meals β”‚ β”‚ (Incidentals stay at 75%) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ’° Cost Calculation Formula ``` Total Travel Cost = Flight + Accommodation + Meals + Incidentals Where: β”œβ”€β”€ Flight = Base Cost Γ— Business Class Multiplier (if β‰₯9 hours) β”œβ”€β”€ Accommodation = Per Night Rate Γ— Number of Nights β”œβ”€β”€ Meals = (Breakfast + Lunch + Dinner) Γ— Number of Days └── Incidentals = Daily Rate Γ— Number of Days Example: β”œβ”€β”€ Flight: $650 Γ— 2.5 = $1,625 (10-hour flight β†’ business class) β”œβ”€β”€ Accommodation: $180 Γ— 3 nights = $540 β”œβ”€β”€ Meals: $119.40 Γ— 4 days = $477.60 └── Incidentals: $17.30 Γ— 4 days = $69.20 ───────────────────────────────────────────────── Total: $2,711.80 CAD ``` ## πŸ—ΊοΈ Region Coverage Map ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ CANADA β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Yukon NWT Nunavut β”‚ β”‚ β”‚ β”‚ $155.70 $159.05 $194.40 β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Provinces (Canada) β”‚ β”‚ β”‚ β”‚ Daily Total: $136.70 CAD β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ UNITED STATES β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Alaska β”‚ β”‚ β”‚ β”‚ $155.70 USD β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Continental USA β”‚ β”‚ β”‚ β”‚ Daily Total: $136.70 USD β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ INTERNATIONAL β”‚ β”‚ Daily Total: $180.00 CAD (average) β”‚ β”‚ (Varies by country - see Appendix D) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ“Š Database Size Comparison ``` File Size Visual: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ perDiemRates.json β”‚ β”‚ β–ˆβ–ˆβ–ˆβ–ˆ ~4KB β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ accommodationRates.json β”‚ β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ~6KB β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ script.js β”‚ β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ~8.5KB β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ styles.css β”‚ β”‚ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ~6.7KB β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Total Project: ~30KB (very lightweight!) ``` ## πŸ”„ Update Frequency Timeline ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Annual Cycle β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ Jan Feb Mar Apr May Jun β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Monitor for updates β”‚ β”‚ β”‚ β”‚ Jul Aug Sep [OCT] Nov Dec β”‚ β”‚ β”‚ β”‚ β”‚ ╔═══╗ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β•‘NEWβ•‘ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β•‘RATES β”‚ β”‚ β”‚ β”‚ β”‚ β•šβ•β•β•β• β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”΄β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Update DB! β”‚ β”‚ β”‚ β”‚ Typical effective date: October 1st β”‚ β”‚ Update databases immediately after release β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## 🎨 JSON Structure Colors (Conceptual) ``` { "metadata": { ... } ← πŸ”΅ Blue (Info) "regions": { ← 🟒 Green (Data) "canada": { ← 🟑 Yellow (Region) "meals": { ... } ← 🟠 Orange (Category) "incidentals": { ... } ← 🟠 Orange (Category) } }, "rateRules": { ... } ← πŸ”΄ Red (Rules) } ``` ## πŸ“ˆ Data Hierarchy ``` Level 0: Database File β”‚ Level 1: β”œβ”€β”€ metadata β”œβ”€β”€ regions / cities └── defaults / rules β”‚ Level 2: └── canada / toronto β”‚ Level 3: β”œβ”€β”€ meals / rates └── incidentals / notes β”‚ Level 4: └── breakfast / standardRate β”‚ Level 5: └── rate100 / value: 29.05 ``` --- **Visual Guide Version:** 1.0 **Created:** October 30, 2025 **Purpose:** Quick reference for database structure and flow