Avaiga / taipy

Turns Data and AI algorithms into production-ready web applications in no time.
https://www.taipy.io
Apache License 2.0
10.94k stars 775 forks source link

Data node Viewer - Add file download/upload capability for file based data nodes #1487

Closed jrobinAV closed 5 days ago

jrobinAV commented 2 months ago

Description When a data node is stored as a file, it would be handy for the end user to add a way to download or upload the file easily from the data node viewer.

This should help the end user understand its data, particularly when data is corrupted or an unexpected behavior happens.

The developer could enable/disable this capability through a property. By default, it should be enabled.

This issue is the GUI part of ticket #1196

Proposal

  1. The download could be accessible through a "Download" button (eventually, an icon when the element width is too small).
  2. The upload could be accessible through an "Upload" file selector (eventually, an icon when the element width is too small). When a file is passed to the Upload mechanism, Taipy should:
    • Check the file (a check property should let the developer provide a custom function).
    • Write the file at the data node path location. Eventually, overwrite it if a file already exists.
    • track the data node edition

Usage

def custom_check(state, file_path) -> bool:
    # Apply the check logic
    return True

<| {selected_datanode} | datanode | file_download=false | file_upload=true | upload_check=custom_check |>
trgiangdo commented 1 month ago

We now have new APIs on Filebased DataNode for download and upload.

The upload_checker should be a Python method that provided by the developer, that takes the file name of the upload data and the data itself as arguments, and return a boolean indicates whether the uploaded file is valid or not.

FredLL-Avaiga commented 1 week ago

is there a Core API to know if a datanode is file based ? @jrobinAV @trgiangdo ?

jrobinAV commented 1 week ago

@FredLL-Avaiga All data nodes based on a file are children of the _FileDataNodeMixin FYI, today we have pickle, csv, excel, json, and parquet.

FredLL-Avaiga commented 1 week ago

I would propose that the call to the user checker function would be surrounded by a try catch @jrobinAV @trgiangdo

https://vscode.dev/github/Avaiga/taipy/blob/develop/taipy/core/data/_file_datanode_mixin.py#L138

FredLL-Avaiga commented 1 week ago

here is what I came up with What do you think @jrobinAV @FabienLelaquais ? image of course with tooltips