htrc / torchlite-backend

Backend API service for Torchlite web dashboard
2 stars 0 forks source link

Implement download the data section of the dashboard menu #120

Closed jswatsch closed 3 weeks ago

jswatsch commented 2 months ago

Implement the download the data functionality. Currently, only the unfiltered download is functional.

jswatsch commented 1 month ago

@sriram04 will make meeting with @dkudeki to discuss blocker

dkudeki commented 1 month ago

@sriram04 I think the structure that makes the most sense for this is to extend the functionality of the existing get_workset_metadata() call in /htrc/torchlite/routers/worksets.py in torchlite-backend. You can add an optional parameter to that route called filtered that defaults to "false", but when it is set to "true" you call apply_filters() on the list of volumes that are generated in that function.

On torchlite-frontend to get it to call this new route on the backend, you would have to setup a function in /src/services/index.tsx that calls /api/worksets/{worksetId}/metadata. Then you would have to build that api call in a new file called /src/pages/api/worksets/[id]/metadata.tsx. You can look here for an example of how to call the backend function you want (without the filter flag) from within that file.

dkudeki commented 1 month ago

@sriram04 Here's the clarifications based on our last discussion. You're going to need to create a new route in /htrc/torchlite/routers/dashboards.py in torchlite-backend. The route should be /{dashboard_id}/{data_type} where data_type could be either "data" or "metadata". This should also support an optional parameter called filtered that defaults to false. The logic for this route will be like a simpler version of get_widget_data(). You'll get the dashboard, get the workset id from that, use that to get the volumes which will be either metadata or full text based on the data_type value, then you'll feed that list of volumes plus the dashboard filters into apply_filters() and return the result.

On torchlite-frontend you'll need to modify the api to call torchlite-backend. Add a route in /src/services/index.tsx that calls /api/dashboards/[id]/[data_type] and then create a file /src/pages/api/dashboards/[id]/[data_type].tsx that holds the logic for calling torchlite-backend. This api call should service all three download types: full, full filtered, and metadata filtered.

jchristie01 commented 1 month ago

Sriram: backend is working. Deren has reviewed the work. Front-end: looks good but needs to link to the backend. New backend API calls have been created.