Skip to content

Develop - #78

Merged
sbudai merged 11 commits into
mainfrom
develop
Oct 16, 2026
Merged

sbudai merged 11 commits into
mainfrom
develop

Conversation

@sbudai

@sbudai sbudai commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Type of change

  • Bug fix
  • New endpoint / feature
  • Refactor / cleanup
  • Documentation only

Affected module(s)

  • en_market
  • en_load
  • en_generation
  • en_transmission
  • en_outages
  • en_balancing
  • en_helpers / utils
  • Tests / CI
  • Documentation / vignettes

Checklist

  • Code follows project conventions (snake_case, cli:: messages, checkmate:: validation)
  • New exported functions include @return and @examplesIf roxygen tags
  • Tests added / updated — covr::package_coverage() passes at 100 %
  • lintr::lint_package() passes with no new warnings
  • devtools::document() run — man pages up-to-date
  • devtools::check() passes locally (0 errors, 0 warnings, 0 notes)
  • No ENTSOE_PAT tokens or secrets committed
  • NEWS.md updated (if user-facing change)

sbudai and others added 11 commits October 15, 2026 15:24
- node_to_rows(): drop unreachable "leaf with sub-children" branch (a leaf
  has xml_length == 0, so it never has element children) and use the
  vectorised xml_name()/xml_text() over nodesets instead of per-node vapply
- new flat_records_to_rows(): extract same-named groups of flat records
  (e.g. Period/Point) with one vectorised pass; falls back to recursion
- new parse_utc_ts(): parse only the distinct timestamps, expand via match()
- rows_to_tbl(): vectorise the heterogeneous-row slow path

xml_to_table() on a 57,600-point document: 10.5s -> 2.2s. Output is
identical on 154 golden outputs replayed from real API responses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace node_to_rows()/rows_to_tbl() with node_to_block() and small block
helpers (new_block, stack_blocks, cross_blocks, block_to_tbl). Each XML
subtree now yields a named list of equal-length columns, so stacking
same-named siblings and cross-joining different-named ones are vectorised
index operations instead of one c() per output row.

flat_records_to_block() fetches all fields of a flat record group (e.g.
Period/Point) with one namespace-agnostic XPath query from the parent,
which is ~3.5x cheaper than xml_children() over a large nodeset.

xml_to_table() on a 57,600-point document: 2.2s -> 1.0s (10.5s before
the previous commit). Raw parser output is identical, including column
order, on 372 real API documents; 154 golden end-to-end outputs match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xmlconvert was only used to read the Reason of XML acknowledgements and
the body of HTML error pages, yet it pulled in 14 packages (readr, vroom,
httr, hms, bit64, tzdb, progress, ...). The new html_error_text() and
xml_error_reason() helpers do the same with xml2, which is already
imported.

Side effect: HTML error pages with a DOCTYPE or with markup inside
<body> now yield their text ("403: Access Denied") instead of an empty
message that ended in "subscript out of bounds".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pers

- nest() -> nest_cols(): vctrs::vec_group_loc() + vec_slice(), grouping
  by the remaining columns in order of first appearance like tidyr
- fill() -> mutate(across(everything(), vec_fill_missing), .by = ...),
  the same vctrs routine tidyr::fill() uses internally
- unite(na.rm = TRUE) -> unite_cols()

vctrs is already a dependency of dplyr, so declaring it adds nothing to
the install footprint, while tidyr and purrr leave the dependency tree.
tidyr moves to Suggests because a vignette still loads it.

Golden replay (154 outputs, exercising 572 unites, 92 nests and the A03
gap filling) is identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xml_find_first()/xml_find_all() default to ns = xml_ns(x), which walks
the whole document to collect namespace prefixes on every call. The
flat-record fast path queries once or twice per record group, so
documents with many TimeSeries paid that scan repeatedly (18% of the
time on real responses). The queries use local-name() and need no
prefixes, so pass ns = character().

Warm replay of 154 real responses: 45.9s -> 37.0s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- lookup_merge(): match()-based column lookup instead of left_join(),
  mirroring its "_x"/"_y" suffix naming; keeps the row count of x even if
  a lookup table ever repeats a code
- my_snakecase(): session cache per column name; the regex chain only
  runs on names not seen before (conversion is element-wise)
- get_eiccodes()/get_all_allocated_eic(): replace "" with NA per column
  instead of via a full logical matrix

Warm replay of 154 real responses: 37.0s -> 31.4s (57.7s originally).
Golden outputs and live all_approved_eic()/all_allocated_eic() results
are identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- api_req() is split into build_api_req() and handle_api_resp(); the new
  api_req_multi() performs several requests with
  httr2::req_perform_parallel() and processes each response like
  api_req(). The first failing request (in query order) raises its error,
  as the sequential loop did.
- Offset pagination and gen_per_gen_unit()'s day-by-day requests use it
  (run_api_queries()). Concurrency: option entsoeapi.max_parallel
  (default 4, 1 = sequential).
- All requests are throttled to 300/minute (platform limit: 400).
- Option entsoeapi.cache_dir switches the EIC table cache from memory to
  a cachem disk cache (entries expire after entsoeapi.cache_max_age
  seconds, default one day). Options are documented in ?entsoeapi.
- Requires httr2 >= 1.1.0; withr added to Suggests for tests.

Live: a 10-day gen_per_gen_unit() query for France went from 340s to
79s. Data identical apart from per-response created_date_time and the
TimeSeries mRID numbering, which the API itself changes between identical
calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
outages_both() wrapped its two calls in try() without silent = TRUE, so
every failing part printed its full "Error in ..." text to stderr on top
of the function's own message. GitHub Actions turns those lines into
error annotations (two on every test-coverage run, from the test that
passes an invalid EIC on purpose).

Use tryCatch() instead and put the reason into the existing message,
e.g. "Get unavailability of generation units error: Invalid EIC checksum
character in `eic`". The return value is unchanged.

The invalid-EIC case is now its own test, which checks the messages and
the empty result. It needs no API access because the EIC check fails
before any request is made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub warns that actions/checkout@v4 and codecov/codecov-action@v4
target Node.js 20, which is deprecated on the runners.

- actions/checkout v4 -> v7 (all workflows)
- codecov/codecov-action v4 -> v7; its deprecated inputs `file` and
  `plugin` are renamed to `files` and `plugins`
- actions/upload-artifact v4 -> v7
- JamesIves/github-pages-deploy-action v4.5.0 -> v4.9.0

All of these now run on Node.js 24 (codecov's action is composite). The
v5-v7 release notes contain no other changes affecting these workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sbudai sbudai self-assigned this Oct 16, 2026
@sbudai
sbudai merged commit 288de97 into main Oct 16, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant