Dash Callback that Reads and Pre-process Data with Progress

So it is my first time to utilize the progress argument of dash.callback. Here’s the basic idea.

  1. A callback whose main purpose is to read, parse, and pre-process a dataset from Store.
  2. While running, a progress bar is being updated to indicate whether process is on-going or not. This is where the challenge is because there’s no clear indicator of how much of the dataset has been read yet.

QUESTION:

  • How do I use the dash.callback which has both Input and States in the argument of the callback function?
  • How do I set_progress to the progress bar given that the process is about reading a dataframe? What do I use as “percentage indicator” of how much is done already?

Here’s a pseudo-code for the entire idea:

@dash.callback(
    output = Output('processedData', 'data'),
    inputs = Input('projectData', 'modified_timestamp'),
    states = State('projectData', 'data'),
    running = [
        (
            Output('progress-bar', 'style'),
            {"visibility": "visible"},
            {"visibility": "hidden"},
        )
    ],
    progress=[Output("progress-bar", "value"), Output("progress-bar", "max")],
)
def processData(set_progress, ts_projectData, projectData):
   # Logic to read the dataframe and pre-process it ...

   # I don't know how to use set_progress()

  return processedDF

Not sure if this has been answered already, but just not too sure what to search exactly tbh. So, thank you in advance!