Skip to content

Comments

Add file analysis route#348

Draft
Pierlou wants to merge 3 commits intomainfrom
feat/analysis-route
Draft

Add file analysis route#348
Pierlou wants to merge 3 commits intomainfrom
feat/analysis-route

Conversation

@Pierlou
Copy link
Contributor

@Pierlou Pierlou commented Oct 15, 2025

Just in case we need it somewhen, this is a starting point

@bolinocroustibat
Copy link
Contributor

I don't see the use case for it YET but I like the beauty of it

Copy link
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

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

So nice!
I absolutely see how this would be useful hihi 🚀

tmp_file = tempfile.NamedTemporaryFile(
dir=config.TEMPORARY_DOWNLOAD_FOLDER or None, delete=False
)
async for chunk in request.content.iter_chunked(1024):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this expects the file as body. Should we use multipart form instead (as is done for file upload) or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed IRL, this should be assessed when we decide the flow of the whole thing (is it called by the browser, by udata...?)

from udata_hydra import config


async def analyse_file(request: web.Request) -> web.Response:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could have a small test? 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely, I am just waiting for the final form to be decided 👹

delete_resource_exception,
None,
),
(web.post, "/api/file-analysis/", analyse_file, None),
Copy link
Contributor

@maudetes maudetes Oct 23, 2025

Choose a reason for hiding this comment

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

By default, post requests require authentication.

It means that it won't be the user client itself that will call this route, but maybe we want to use udata or cdata api as proxy?

Edit: As discussed, we should discuss the needed workflow, if the call comes from udata, it's fine.
However, if we want the client to use this endpoint with the first rows of its file, we may need to open it.

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.

3 participants