API Query enrichment through custom function

yashpuranik Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2022, Neuron 2023 Posts: 69 Neuron

Hi All,

I know that API Developer allows for enrichment with look ups from a particular dataset/SQL table. Can this enrichment happen through a custom Python function or with a visual recipe?

I am thinking of a use case say where I have input data with latitude/longitude information. In my flow, using suitable prepare steps, I can create additional features for say county/city with reverse geocoding and use them for my prediction models. I can also develop an API endpoint for this prediction model with API Developer.

However, this API now expects county/city information in the query. The county/city information cannot be looked up from a table. How can I have this information generated within the API so that these features are available for my prediction model?



  • HarizoR
    HarizoR Dataiker, Alpha Tester, Registered Posts: 138 Dataiker

    Hi yashpuranik,

    You will need to code the reverse geocoding logic yourself and include it in a Python function endpoint which will take your raw input data point, enrich it (i.e. add the relevant key-value pairs in the JSON payload) and forward it to the Prediction endpoint. To learn more about this usage pattern, you can read this page of the documentation explaining the concept of "dispatcher endpoint".

    It is unfortunately impossible to reuse the reverse geocoding step from the Prepare recipe/Analysis script, as it relies on a plugin installed on your Design node that cannot be packaged in your API service.

    Hope this helps.



Setup Info
      Help me…