Skip to content

Fix slack variable detection in categorize_data#71

Closed
PabloBotinGP wants to merge 2 commits into
Sienna-Platform:jd/misc_fixesfrom
PabloBotinGP:pb/46-categorize-data-slack-variables
Closed

Fix slack variable detection in categorize_data#71
PabloBotinGP wants to merge 2 commits into
Sienna-Platform:jd/misc_fixesfrom
PabloBotinGP:pb/46-categorize-data-slack-variables

Conversation

@PabloBotinGP

@PabloBotinGP PabloBotinGP commented May 6, 2026

Copy link
Copy Markdown
Contributor

categorize_data was supposed to label slack variables as "Unserved Energy" and "Over Generation" in its output, but it silently dropped them, so those keys never appeared in the result. Any dispatch run with infeasibility was therefore missing those.

The problem wqas that in src/get_data.jl:612, the substring needle was built with string(slack), where slack is a DataType like PSI.SystemBalanceSlackDown. In Julia, string(SomeType) returns the fully qualified name ("PowerSimulations.SystemBalanceSlackDown"). But PSI result keys are bare (:SystemBalanceSlackDown__System, no module prefix), so the occursin check never matched and the loop body never ran.

The fix: string(slack)string(nameof(slack)). 'nameof returns just the bare type name (:SystemBalanceSlackDown`), which matches the PSI key format.

A new @testset in test/test_result_sorting.jl builds a synthetic Dict{Symbol, DataFrame} with keys :SystemBalanceSlackUp__System and :SystemBalanceSlackDown__System, calls categorize_data, and asserts that both "Unserved Energy" and "Over Generation" appear in the output, mapped to the original DataFrames.

Changes are minimal but they seem to be more because I run the JuliaFormatter which fixed many different things.

closes #46

Copilot AI and others added 2 commits April 20, 2026 18:31
…enna-Platform#68)

* Initial plan

* Update legacy org, docs domain, and Slack workspace references

Agent-Logs-Url: https://github.com/Sienna-Platform/PowerAnalytics.jl/sessions/f7d7ad47-b1c6-439f-a209-13e78403092c

Co-authored-by: jd-lara <16385323+jd-lara@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jd-lara <16385323+jd-lara@users.noreply.github.com>
@jd-lara jd-lara changed the base branch from main to jd/misc_fixes May 18, 2026 17:31
@jd-lara

jd-lara commented May 18, 2026

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

@jd-lara

jd-lara commented May 19, 2026

Copy link
Copy Markdown
Member

closed in favor of #73

@jd-lara jd-lara closed this May 19, 2026
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.

categorize_data misses slack variables

3 participants