Skip to content

Commit 6703d37

Browse files
fix(BE): remove space in multi-source string for Elia link
The merged production source was "entsoe.eu, opendata.elia.be" for hours with storage data. When the app splits source attribution on "," without trimming, the second name becomes " opendata.elia.be", which is turned into a broken href with a %20 prefix. Use a comma without a following space so both source names stay clean. Same class of bug as #8779 / #8800 (GB) / #8801 (SG); the comma-space was introduced here in #8787 (b47c731), which started reporting a combined ENTSO-E/Elia source for hours with storage data. Updates the BE production snapshot accordingly.
1 parent db11e59 commit 6703d37

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

electricitymap/contrib/parsers/BE.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,10 @@ def fetch_production(
203203
end_datetime=event.end_datetime,
204204
production=event.production,
205205
storage=storage,
206-
source=f"{ENTSOE.SOURCE}, {SOURCE_ELIA}" if storage else SOURCE_ELIA,
206+
# No space after comma so source names stay clean when split on ","
207+
# (avoids a leading-space " opendata.elia.be" / https://%20… link;
208+
# same class of bug as #8779 / #8800 / #8801).
209+
source=f"{ENTSOE.SOURCE},{SOURCE_ELIA}" if storage else SOURCE_ELIA,
207210
)
208211

209212
# Hours where Elia has no data at all: fall back to the full ENTSOE event.

electricitymap/contrib/parsers/tests/__snapshots__/test_BE/test_fetch_production.ambr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
'unknown': 607.0,
4040
'wind': 4217.0,
4141
}),
42-
'source': 'entsoe.eu, opendata.elia.be',
42+
'source': 'entsoe.eu,opendata.elia.be',
4343
'sourceType': <EventSourceType.measured: 'measured'>,
4444
'storage': dict({
4545
'battery': -25.0,
@@ -62,7 +62,7 @@
6262
'unknown': 600.66,
6363
'wind': 4251.79,
6464
}),
65-
'source': 'entsoe.eu, opendata.elia.be',
65+
'source': 'entsoe.eu,opendata.elia.be',
6666
'sourceType': <EventSourceType.measured: 'measured'>,
6767
'storage': dict({
6868
'battery': -25.0,
@@ -85,7 +85,7 @@
8585
'unknown': 591.49,
8686
'wind': 4266.5,
8787
}),
88-
'source': 'entsoe.eu, opendata.elia.be',
88+
'source': 'entsoe.eu,opendata.elia.be',
8989
'sourceType': <EventSourceType.measured: 'measured'>,
9090
'storage': dict({
9191
'battery': -25.0,

electricitymap/contrib/parsers/tests/test_BE.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def test_elia_quarters_keep_entsoe_storage(by_datetime):
6767
# The hourly ENTSOE storage is step-held onto each 15-min slot, incl. pumping
6868
# (715 MW) which only ENTSOE reports (Elia ods201 has no consumption side).
6969
for dt in ELIA_QUARTERS:
70-
assert by_datetime[dt]["source"] == "entsoe.eu, opendata.elia.be"
70+
assert by_datetime[dt]["source"] == "entsoe.eu,opendata.elia.be"
7171
assert by_datetime[dt]["storage"] == {"battery": -25.0, "hydro": 715.0}
7272

7373

0 commit comments

Comments
 (0)