Skip to content

feat(scenario-builder): implement database support#3020

Merged
TheoPascoli merged 22 commits intodevfrom
feat/scenario-builder
Mar 4, 2026
Merged

feat(scenario-builder): implement database support#3020
TheoPascoli merged 22 commits intodevfrom
feat/scenario-builder

Conversation

@TheoPascoli
Copy link
Copy Markdown
Contributor

@TheoPascoli TheoPascoli commented Feb 23, 2026

No description provided.

@TheoPascoli TheoPascoli marked this pull request as draft February 23, 2026 14:50
@TheoPascoli TheoPascoli marked this pull request as ready for review February 25, 2026 07:57
@TheoPascoli TheoPascoli requested a review from a team February 25, 2026 07:57
Copy link
Copy Markdown
Contributor

@MartinBelthle MartinBelthle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the possibility of having different rulesets and to select the active one among them makes the code harder to understand, the database bigger nad the queries slower. It's not because the simulator allows it that we should continue handle this in the webapp.
To me we should ensure with the users if they really use this feature as it would make the code easier. I asked Alexander and he does not even seem to understand that this is possible, I'll show him tomorrow and I think we should ask Benoit to do a poll in the Teams conversation with the users

Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
@MartinBelthle
Copy link
Copy Markdown
Contributor

MartinBelthle commented Feb 25, 2026

For 500 recette studies and 650 production ones I only found 2 studies where someone uses a different ruleset than default ruleset (same study apparently but copied).
The man just used new ruleset but didn't even have a default ruleset in his study so we could just rename this and it would be good

Copy link
Copy Markdown
Contributor

@MartinBelthle MartinBelthle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea for a next work: We should add a DAo method that just saves the data for one scenario type, as this would allow the front-end to be way faster when updating the scenario builder as for now we're reading all and saving all

Comment thread alembic/versions/c11cfe5728b0_add_ruleset_table.py Outdated
sa.Column("area_id", sa.String(length=255), nullable=False),
sa.Column("st_storage_id", sa.String(length=255), nullable=False),
sa.Column("constraint_id", sa.String(length=255), nullable=False),
sa.Column("timeseries", sa.JSON(), nullable=False),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discussed the naming timeseries with Sylvain and we don't think it's the right one. Moreover, for hydro levels they do not even represent a mapping towards a timeserie. I don't have an idea for a name though :/

from antarest.study.business.model.scenario_builder_model import Ruleset, ScenarioType
from antarest.study.business.model.sts_model import STStorage, STStorageAdditionalConstraint
from antarest.study.business.model.thermal_cluster_model import ThermalCluster
from antarest.study.dao.database.database_study_dao import DatabaseStudyDao
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add tests to ensures when deleting a thermal for example, the sc builder is also empty (even if it's by construction it's nice). And also remove the TODOs inside thermal_dao and renewable_dao (at least) saying that we should perhaps do something when deleting

Copy link
Copy Markdown
Contributor

@MartinBelthle MartinBelthle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-discussed the naming with Sylvain and he prefers to name ts_numbers, value to be as general as possible as for hydro levels it does not represent ts_numbers but rather a percentage to follow.

Other than that, we're good to merge

@TheoPascoli TheoPascoli merged commit a85b4ab into dev Mar 4, 2026
21 of 22 checks passed
@TheoPascoli TheoPascoli deleted the feat/scenario-builder branch March 4, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants