Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category data structures should be generated dynamically from database contents #120

Open
interplanetarychris opened this issue Apr 24, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@interplanetarychris
Copy link
Contributor

The following really shouldn't be hard-coded, and instead should be dynamically generated from the contents of the categories table in the database.

celestrakCategories = { "data": [
{
"groupHeader": { "title": "Featured", "path": "featured" },
"groupCategories": [
{ "title": "100 Brightest", "path": "visual" },
{ "title": "Starlink", "path": "starlink" },
{
"title": "OneWeb",
"path": "one-web"
},
{
"title": "Active Sats",
"path": "active"
},
{
"title": "Analyst sats",
"path": "analyst"
}
]
},
{
"groupHeader": {
"title": "Weather & Earth Resources",
"path": "weather-earth"
},
"groupCategories": [
{ "title": "Weather", "path": "weather" },
{ "title": "NOAA", "path": "noaa" },
{
"title": "GOES",
"path": "goes"
},
{
"title": "Earth Resources",
"path": "resource"
},
{
"title": "Search & Rescue (SARSAT)",
"path": "sarsat"
},
{
"title": "Disaster Monitoring",
"path": "disaster-monitoring"
},
{
"title": "Tracking and Data Relay Satellite System (TDRSS)",
"path": "tracking-and-data-relay"
},
{
"title": "ARGOS Data Collection",
"path": "argos"
},
{
"title": "System",
"path": "system-weather-and-earth-resources"
},
{
"title": "Planet",
"path": "planet"
},
{
"title": "Spire",
"path": "spire"
}
]
},
{
"groupHeader": { "title": "Communications", "path": "communications" },
"groupCategories": [
{ "title": "Geosynchronous", "path": "geo" },
{ "title": "GEO Protected Zone", "path": "geo-protected-zone" },
{
"title": "GEO Protected Zone Plus",
"path": "geo-protected-zone-plus"
},
{
"title": "Intelsat",
"path": "intelsat"
},
{
"title": "SES",
"path": "ses"
},
{
"title": "Iridium",
"path": "iridium"
},
{
"title": "Iridium Next",
"path": "iridium-next"
},
{
"title": "Orbcomm",
"path": "orbcomm"
},
{
"title": "Globalstar",
"path": "globalstar"
},
{
"title": "Amateur Radio",
"path": "amateur-radio"
},
{
"title": "Experimental",
"path": "experimental"
},
{
"title": "Other Comm",
"path": "other-comm"
},
{
"title": "SatNOGS",
"path": "satnogs"
},
{
"title": "Gorizant",
"path": "gorizant"
},
{
"title": "Raduga",
"path": "raduga"
},
{
"title": "Molniya",
"path": "molniya"
}
]
},
{
"groupHeader": { "title": "Navigation", "path": "navigation" },
"groupCategories": [
{ "title": "GPS Operational", "path": "gps-ops" },
{ "title": "GLONASS Operational", "path": "glonass-operational" },
{
"title": "Galileo",
"path": "galileo"
},
{
"title": "Beidou",
"path": "beidou"
},
{
"title": "Satellite-Based Augmentation System (WAAS/EGNOS/MSAS)",
"path": "satellite-based-augmentation"
},
{
"title": "System",
"path": "system-navigation"
},
{
"title": "Russian LEO Navigation",
"path": "musson"
}
]
},
{
"groupHeader": { "title": "Debris", "path": "debris" },
"groupCategories": [
{ "title": "Indian ASAT Test", "path": "indian-asat-test" },
{
"title": "IRIDIUM 33",
"path": "iridium-33"
},
{
"title": "COSMOS 2251",
"path": "cosmos-2251"
}
]
},
{
"groupHeader": { "title": "Scientific", "path": "scientific" },
"groupCategories": [
{ "title": "Space & Earth Science", "path": "science" },
{ "title": "Geodetic", "path": "geodetic" },
{
"title": "Engineering",
"path": "engineering"
},
{
"title": "Education",
"path": "education"
}
]
},
{
"groupHeader": { "title": "Misc.", "path": "misc" },
"groupCategories": [
{ "title": "Miscellaneous Military", "path": "military" },
{ "title": "Radar Calibration", "path": "radar-calibration" },
{
"title": "CubeSats",
"path": "cubesat"
},
{
"title": "Space Stations",
"path": "stations"
},
{
"title": "Other",
"path": "other"
}
]
},
{
"groupHeader": { "title": "All", "path": "all"},
"groupCategories": []
}
]
}

trusat-backend/database.py

Lines 2879 to 2986 in a6eb293

def selectTLE_categories(self, category):
categories_list = {
"trusat_featured.txt": '"100 (or so) Brightest" OR' +\
' categories.sub_category = "Starlink" OR' +\
' categories.sub_category = "OneWeb" OR' +\
' categories.sub_category = "Active Satellites" OR' +\
' categories.sub_category = "Analyst Satellites"',
"trusat_visual.txt": '"100 (or so) Brightest"',
"trusat_starlink.txt": '"Starlink"',
"trusat_one-web.txt": '"OneWeb"',
"trusat_active.txt": '"Active Satellites"',
"trusat_analyst.txt": '"Analyst Satellites"',
"trusat_weather-earth.txt": '"Weather" OR categories.sub_category = "NOAA" OR' +\
' categories.sub_category = "GOES" OR' +\
' categories.sub_category = "Earth Resources" OR' +\
' categories.sub_category = "Search and Rescue (SARSAT)" OR' +\
' categories.sub_category = "Disaster Monitoring" OR' +\
' categories.sub_category = "Tracking and Data Relay Satellite System (TDRSS)" OR' +\
' categories.sub_category = "ARGOS Data Collection System" OR' +\
' categories.sub_category = "Planet" OR categories.sub_category = "Spire"',
"trusat_weather.txt": '"Weather"',
"trusat_noaa.txt": '"NOAA"',
"trusat_goes.txt": '"GOES"',
"trusat_resource.txt": '"Earth Resources"',
"trusat_sarsat.txt": '"Search & Rescue (SARSAT)"',
"trusat_disaster-monitoring.txt": '"Disaster Monitoring"',
"trusat_tracking-and-data-relay.txt": '"Tracking and Data Relay Satellite System (TDRSS)"',
"trusat_argos.txt": '"ARGOS Data Collection System"',
"trusat_planet.txt": '"Planet"',
"trusat_spire.txt": '"Spire"',
"trusat_communications.txt": '"Active Geosynchronous" OR' +\
' categories.sub_category = "GEO Protected Zone" OR' +\
' categories.sub_category = "GEO Protected Zone Plus" OR' +\
' categories.sub_category = "Intelsat" OR' +\
' categories.sub_category = "SES" OR' +\
' categories.sub_category = "Iridium" OR' +\
' categories.sub_category = "Iridium NEXT" OR' +\
' categories.sub_category = "Orbcomm" OR' +\
' categories.sub_category = "Globalstar" OR' +\
' categories.sub_category = "Amateur Radio" OR' +\
' categories.sub_category = "Experimental" OR' +\
' categories.sub_category = "Other Comm" OR' +\
' categories.sub_category = "SatNOGS" OR' +\
' categories.sub_category = "Gorizont" OR' +\
' categories.sub_category = "Raduga" OR' +\
' categories.sub_category = "Molniya"',
"trusat_geo.txt": '"Active Geosynchronous"',
"trusat_geo-protected-zone.txt": '"GEO Protected Zone"',
"trusat_geo-protected-zone-plus.txt": '"GEO Protected Zone Plus"',
"trusat_intelsat.txt": '"Intelsat"',
"trusat_ses.txt": '"SES"',
"trusat_iridium.txt": '"Iridium"',
"trusat_iridium-next.txt": '"Iridium NEXT"',
"trusat_orbcomm.txt": '"Orbcomm"',
"trusat_globalstar.txt": '"Globalstar"',
"trusat_amateur-radio.txt": '"Amateur Radio"',
"trusat_experimental.txt": '"Experimental"',
"trusat_other-comm.txt": '"Other Comm"',
"trusat_satnogs.txt": '"SatNOGS"',
"trusat_gorizant.txt": '"Gorizont"',
"trusat_raduga.txt": '"Raduga"',
"trusat_molniya.txt": '"Molniya"',
"trusat_navigation.txt": '"GPS Operational" OR' +\
' categories.sub_category = "GLONASS Operational" OR' +\
' categories.sub_category = "Galileo" OR' +\
' categories.sub_category = "Beidou" OR' +\
' categories.sub_category = "Satellite-Based Augmentation System (WAAS/EGNOS/MSAS)" OR' +\
' categories.sub_category = "Navy Navigation Satellite System (NNSS)" OR' +\
' categories.sub_category = "Russian LEO Navigation"',
"trusat_gps-ops.txt": '"GPS Operational"',
"trusat_glonass-operational.txt": '"GLONASS Operational"',
"trusat_galileo.txt": '"Galileo"',
"trusat_beidou.txt": '"Beidou"',
"trusat_satellite-based-augmentation.txt": '"Satellite-Based Augmentation System (WAAS/EGNOS/MSAS)"',
"trusat_system-navigation.txt": '"Navy Navigation Satellite System (NNSS)"',
"trusat_musson.txt": '"Russian LEO Navigation"',
"trusat_debris.txt": '"Indian ASAT Test Debris" OR' +\
' categories.sub_category = "IRIDIUM 33 Debris" OR' +\
' categories.sub_category = "COSMOS 2251 Debris" OR' +\
' categories.sub_category = "Space & Earth Science" OR' +\
' categories.sub_category = "Geodetic" OR' +\
' categories.sub_category = "Engineering" OR' +\
' categories.sub_category = "Education"',
"trusat_indian-asat-test.txt": '"Indian ASAT Test Debris"',
# "1999-025": g.get('db').selectCatalog_1999_025_JSON,
"trusat_iridium-33.txt": '"IRIDIUM 33 Debris"',
"trusat_cosmos-2251.txt": '"COSMOS 2251 Debris"',
# "2012-044": g.get('db').selectCatalog_All_JSON,
"trusat_scientific.txt": '"Space & Earth Science" OR' +\
' categories.sub_category = "Geodetic" OR' +\
' categories.sub_category = "Engineering" OR' +\
' categories.sub_category = "Education"',
"trusat_science.txt": '"Space & Earth Science"',
"trusat_geodetic.txt": '"Geodetic"',
"trusat_engineering.txt": '"Engineering"',
"trusat_education.txt": '"Education"',
"trusat_misc.txt": '"Miscellaneous Military" OR' +\
' categories.sub_category = "Radar Calibration" OR' +\
' categories.sub_category = "CubeSats" OR' +\
' categories.sub_category = "Space Stations" OR' +\
' categories.sub_category = "Other"',
"trusat_military.txt": '"Miscellaneous Military"',
"trusat_radar-calibration.txt": '"Radar Calibration"',
"trusat_cubesat.txt": '"CubeSats"',
# "tle-new": g.get('db').selectCatalog_All_JSON,
"trusat_stations.txt": '"Space Stations"',
"trusat_other.txt": '"Other"'
}

@interplanetarychris interplanetarychris added the enhancement New feature or request label Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant