Simplify API for band conditions #92

This commit is contained in:
Ian Renton
2026-03-29 08:31:36 +01:00
parent 11d71629ce
commit ed1f9e5b06
13 changed files with 110 additions and 124 deletions

View File

@@ -1356,47 +1356,6 @@ components:
description: Regex that matches this SIG's reference IDs. Generally for Spothole's own internal use, clients probably won't need this.
example: "[A-Z]{2}\\-\\d+"
HFBandCondition:
type: object
description: HF propagation conditions for a group of bands at a particular time of day.
properties:
band:
type: string
description: Band group, e.g. "80m-40m", "30m-20m", "17m-15m", "10m-6m". As provided by HamQSL.
example: "80m-40m"
time:
type: string
description: Time of day these conditions apply to. As provided by HamQSL.
enum:
- day
- night
example: day
condition:
type: string
description: Propagation condition assessment. As provided by HamQSL.
enum:
- Good
- Fair
- Poor
example: Good
VHFCondition:
type: object
description: A VHF propagation phenomenon and its current condition.
properties:
phenomenon:
type: string
description: The name of the propagation phenomenon, e.g. "E-Skip", "vhf-aurora". As provided by HamQSL.
example: "E-Skip"
location:
type: string
description: The geographic region this condition applies to, e.g. "europe", "north_america", "northern_hemi". As provided by HamQSL.
example: "europe"
condition:
type: string
description: The current condition for this phenomenon and location.
example: "Band Closed"
SolarConditions:
type: object
description: Current solar and propagation conditions. All fields may be null if no provider has successfully fetched data yet.
@@ -1458,15 +1417,57 @@ components:
description: Geomagnetic background noise level on HF, in S-units
example: "S0"
hf_conditions:
type: array
description: HF propagation condition assessments by band group and time of day
items:
$ref: '#/components/schemas/HFBandCondition'
type: object
description: HF propagation condition assessments, keyed by "{band}-{time}" e.g. "80m-40m-day"
properties:
80m-40m-day:
type: string
enum: [Good, Fair, Poor]
80m-40m-night:
type: string
enum: [Good, Fair, Poor]
30m-20m-day:
type: string
enum: [Good, Fair, Poor]
30m-20m-night:
type: string
enum: [Good, Fair, Poor]
17m-15m-day:
type: string
enum: [Good, Fair, Poor]
17m-15m-night:
type: string
enum: [Good, Fair, Poor]
12m-10m-day:
type: string
enum: [Good, Fair, Poor]
12m-10m-night:
type: string
enum: [Good, Fair, Poor]
vhf_conditions:
type: array
description: VHF propagation condition assessments by phenomenon and location
items:
$ref: '#/components/schemas/VHFCondition'
type: object
description: VHF propagation condition assessments, keyed by condition name
properties:
vhf_aurora_northern_hemi:
type: string
description: VHF aurora propagation condition for the northern hemisphere
example: "Band Closed"
es_2m_europe:
type: string
description: Sporadic-E propagation condition on 2m for Europe
example: "Band Closed"
es_4m_europe:
type: string
description: Sporadic-E propagation condition on 4m for Europe
example: "Band Closed"
es_6m_europe:
type: string
description: Sporadic-E propagation condition on 6m for Europe
example: "Band Closed"
es_2m_na:
type: string
description: Sporadic-E propagation condition on 2m for North America
example: "Band Closed"
blackout_desc:
type: string
description: HF radio blackout risk description, derived from the X-ray flux class.

View File

@@ -1,32 +1,26 @@
// Load solar conditions
function loadSolarConditions() {
$.getJSON('/api/v1/solar', function(jsonData) {
// HF
const hfConditionClass = { 'Good': 'table-success', 'Fair': 'table-warning', 'Poor': 'table-danger' };
if (jsonData.hf_conditions) {
jsonData.hf_conditions.forEach(function(entry) {
const cell = $('#hf-conditions-' + entry.band + '-' + entry.time);
cell.text(entry.condition);
const cls = hfConditionClass[entry.condition];
if (cls) { cell.addClass(cls); }
Object.entries(jsonData.hf_conditions).forEach(function([key, condition]) {
const cell = $('#hf-conditions-' + key);
cell.text(condition);
cell.addClass(hfConditionClass[condition]);
});
}
const vhfIdMap = {
'vhf-aurora|northern_hemi': 'vhf-conditions-aurora',
'E-Skip|europe_6m': 'vhf-conditions-es-6m-eu',
'E-Skip|europe_4m': 'vhf-conditions-es-4m-eu',
'E-Skip|europe': 'vhf-conditions-es-2m-eu',
'E-Skip|north_america':'vhf-conditions-es-2m-na',
};
// VHF
if (jsonData.vhf_conditions) {
jsonData.vhf_conditions.forEach(function(entry) {
const id = vhfIdMap[entry.phenomenon + '|' + entry.location];
if (id) {
const cell = $('#' + id);
cell.text(entry.condition);
cell.addClass(entry.condition === 'Band Closed' ? 'table-danger' : 'table-success');
}
Object.entries(jsonData.vhf_conditions).forEach(function([key, condition]) {
const cell = $('#vhf-conditions-' + key);
cell.text(condition);
cell.addClass(condition === 'Band Closed' ? 'table-danger' : 'table-success');
});
}
if (jsonData.aurora_latitude !== null && jsonData.aurora_latitude !== undefined) {