I want to improve the logic for my task that is defined as following, the tasks is implemented in Python 3 with Django framwork:
The source data is onboard to our sys