Commit 7bc0ac4
Collapse source class tables into one SOURCES registry
SOURCE_DICT and the two *_SOURCE_PAIRS tables each repeated the same connector
classes, so adding a source meant editing three tables in lockstep (plus the
orchestration list, fixed in the prior change). They are now derived from a
single `SOURCES` registry of `SourceDef(key, site, waterlevel?, analyte?)`:
SOURCE_DICT = {s.key: s.site ...}
WATERLEVEL_SOURCE_PAIRS = {s.key: (s.site, s.waterlevel) for s with waterlevel}
ANALYTE_SOURCE_PAIRS = {s.key: (s.site, s.analyte) for s with analyte}
Adding a source is now one SourceDef entry (plus listing it under the
parameters it serves in PARAMETER_SOURCE_MAP, which stays as authored data —
it encodes which analytes each agency actually reports).
tests/test_source_registry.py ties the registry to PARAMETER_SOURCE_MAP: the
waterlevels agency list must equal the set of sources with a waterlevel class,
and every analyte agency must have an analyte class — so a source wired in one
place but not the other fails a test instead of silently dropping out.
Iteration order of water_level_sources()/analyte_sources() is now source-key
order (was a hand-curated order); full suite (306) confirms nothing depends on
the old order. dg check defs clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 23ded14 commit 7bc0ac4
2 files changed
Lines changed: 109 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
113 | 145 | | |
114 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
115 | 150 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 151 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 152 | + | |
126 | 153 | | |
127 | | - | |
128 | 154 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 155 | + | |
138 | 156 | | |
139 | 157 | | |
140 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
0 commit comments