Skip to content

feat(output): implement a retrocompatibility layer for /raw endpoint#3093

Open
TheoPascoli wants to merge 17 commits intodevfrom
feat/output-retrocompatibility
Open

feat(output): implement a retrocompatibility layer for /raw endpoint#3093
TheoPascoli wants to merge 17 commits intodevfrom
feat/output-retrocompatibility

Conversation

@TheoPascoli
Copy link
Contributor

No description provided.

@TheoPascoli TheoPascoli requested a review from a team March 10, 2026 14:42
Copy link
Member

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Looks pretty good already ! but a few things can be made simpler or moved

frequency: MatrixFrequency,
columns_names: Sequence[str],
ids_to_consider: Sequence[str],
transform_columns_headers: bool = True,
Copy link
Member

Choose a reason for hiding this comment

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

should be remove for this endpoint too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kept: both call sites need different values: False for the legacy path (splittable column names), True for the new matrix format. Tell me if you have any idea

@TheoPascoli TheoPascoli requested a review from sylvlecl March 16, 2026 09:57

return download_id

def aggregate_output_data(
Copy link
Member

Choose a reason for hiding this comment

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

I think this one can be removed now

frequency=parsed.frequency,
item_id=parsed.ids_to_consider,
mc_year=parsed.mc_year,
transform_columns_headers=False,
Copy link
Member

Choose a reason for hiding this comment

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

don't think we need the False here, it's only meant to be used by the "download" endpoint which will not go through that method --> hence I think we can remove the parameter also from the methode

@TheoPascoli TheoPascoli requested a review from sylvlecl March 18, 2026 08:56
@gitguardian
Copy link

gitguardian bot commented Mar 19, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
14433192 Triggered Authentication Tuple b284fa2 antarest/dependencies.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link
Member

@sylvlecl sylvlecl 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 there is still one thing to fix, so that formatting options are correctly taken into account

item_id=parsed.ids_to_consider,
mc_year=parsed.mc_year,
)
return {
Copy link
Member

Choose a reason for hiding this comment

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

We should just return the polars dataframe here so that it is then formatted by the web layer.
See that piece of code:

if isinstance(output, pl.DataFrame):
    if matrix_format is None:
        matrix_format = MatrixFormat.JSON if formatted else MatrixFormat.PLAIN
    return matrix_format.serialize_dataframe(output)

Makes me think that we probably don't have integration tests that cover this correctly:
I think in the current state, the "formatting" options (formatted & matrix_format) of the endpoint will not be taken into account correctly, since they are used by the web layer only if this returns a dataframe.

--> we should add an integration test which checks the behaviour of those parameters for an output matrix (we can use the STA-mini study for that)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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