I have to iterate through a list of functions in python and decide which ones to call based on whether the arguments for each function are present in a JSON file. After a function is called, its return value is also added to the JSON file. Since a function's output value can end up being the input value for another function, I iterate through the list of functions multiple times.
The structure of the JSON file looks something like this:
"name": "town name"
"address": "address 1"
"address": "address 3"
"stores": [ist of dicts],
Examples of functions would be findSportsStores(stores) and isParkOpen(openingHours). A function can ask for arguments from specific buildings and/or from the parent node (town).
In this case only the first function would run since the argument stores is present. The second wouldn't since the argument openingHours is not present in park in the JSON file.
What I have tried:
My first attempt to implement this argument search was by using the name of the argument being searched and pointing it to a specific node in the JSON.
The problem is: how do I find these arguments without hardcoding the rules? For example for the above situation when iterating through the JSON file the argument openingHours in mall should not be confused with the argument the specific function is looking for (openingHours in park). The JSON file in itself depends on the user so it can have way more buildings with more information and identically named keys in different buildings (for example address), so I definitely want to avoid a hardcoded solution when looking for each function's arguments since the solution has to be flexible due to the user-dependent JSON file as input.
I have read about knowledge graphs and was wondering, would that be an appropriate solution for this argument search? If so, how would I proceed?
If not, any pointers to a better solution would be highly appreciated.