mirror of
https://github.com/mblanke/Gov_Travel_App.git
synced 2026-03-01 14:10:22 -05:00
Integrate OpenFlights API for free, no-auth flight data generation
- Added openFlightsService.js to fetch and cache OpenFlights airport/airline/routes data - Validates airport codes exist in OpenFlights database (6072+ airports) - Generates realistic flights using major international airlines - Creates varied routing options: direct, 1-stop, 2-stop flights - Updated flightService.js to use OpenFlights as primary source before Amadeus - OpenFlights as fallback if Amadeus unavailable or returns no results - No API keys or authentication required - Cached locally to avoid repeated network requests - Realistic pricing, times, and stop locations Docker container rebuilt with OpenFlights integration.
This commit is contained in:
18
scripts/db_summary.py
Normal file
18
scripts/db_summary.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('data/travel_rates_scraped.sqlite3')
|
||||
cur = conn.cursor()
|
||||
|
||||
cur.execute('SELECT COUNT(*) FROM rate_entries')
|
||||
print('Per-diem entries:', cur.fetchone()[0])
|
||||
|
||||
cur.execute('SELECT COUNT(*) FROM accommodations')
|
||||
print('Accommodation entries:', cur.fetchone()[0])
|
||||
|
||||
cur.execute('SELECT COUNT(DISTINCT country) FROM rate_entries WHERE source="international"')
|
||||
print('Countries with per-diem:', cur.fetchone()[0])
|
||||
|
||||
cur.execute('SELECT COUNT(DISTINCT city) FROM accommodations')
|
||||
print('Canadian cities with accommodation listings:', cur.fetchone()[0])
|
||||
|
||||
conn.close()
|
||||
16
scripts/debug_canberra.py
Normal file
16
scripts/debug_canberra.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('data/travel_rates_scraped.sqlite3')
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("""
|
||||
SELECT city, currency, rate_type, rate_amount
|
||||
FROM rate_entries
|
||||
WHERE country = 'Australia' AND city LIKE '%Canberra%'
|
||||
ORDER BY city, rate_type
|
||||
""")
|
||||
|
||||
for row in cursor.fetchall():
|
||||
print(row)
|
||||
|
||||
conn.close()
|
||||
54
scripts/show_country_rates.py
Normal file
54
scripts/show_country_rates.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import sqlite3
|
||||
|
||||
conn = sqlite3.connect('data/travel_rates_scraped.sqlite3')
|
||||
cursor = conn.cursor()
|
||||
|
||||
countries = ['Latvia', 'Germany', 'Dominican Republic', 'Brazil', 'Australia']
|
||||
|
||||
for country in countries:
|
||||
print(f"\n{'='*80}")
|
||||
print(f"{country.upper()}")
|
||||
print(f"{'='*80}")
|
||||
|
||||
# Get all cities for this country
|
||||
cursor.execute("""
|
||||
SELECT DISTINCT city, currency
|
||||
FROM rate_entries
|
||||
WHERE country = ? AND city IS NOT NULL
|
||||
ORDER BY city
|
||||
""", (country,))
|
||||
|
||||
cities = cursor.fetchall()
|
||||
|
||||
if not cities:
|
||||
print(f"No cities found for {country}")
|
||||
continue
|
||||
|
||||
for city_name, currency in cities:
|
||||
print(f"\n📍 {city_name} ({currency})")
|
||||
print("-" * 80)
|
||||
|
||||
# Get meal rates for this city
|
||||
cursor.execute("""
|
||||
SELECT rate_type, rate_amount
|
||||
FROM rate_entries
|
||||
WHERE country = ? AND city = ? AND rate_type IN
|
||||
('breakfast', 'lunch', 'dinner', 'incidental amount')
|
||||
ORDER BY CASE
|
||||
WHEN rate_type = 'breakfast' THEN 1
|
||||
WHEN rate_type = 'lunch' THEN 2
|
||||
WHEN rate_type = 'dinner' THEN 3
|
||||
WHEN rate_type = 'incidental amount' THEN 4
|
||||
END
|
||||
""", (country, city_name))
|
||||
|
||||
rates = cursor.fetchall()
|
||||
if rates:
|
||||
for rate_type, amount in rates:
|
||||
# Format the display
|
||||
type_display = rate_type.replace('incidental amount', 'Incidentals').title()
|
||||
print(f" {type_display:.<25} ${amount:>8.2f} {currency}")
|
||||
else:
|
||||
print(" No rate details found")
|
||||
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user