IP Address Lookup Analytic
This use case shows a more complex lookup use case using a local analytic.
In this example, we will show how to create a .air
file to perform a lookup of analytic results from a local analytic - in this case, a JSON data structure. To do this, we will create a simple example which will utilize a regular expression to identify strings of digits which could potentially be IP addresses. Once those are identified, the IP addresses will be looked up in a fictional user database to see if there is any additional information about that user.
Dependencies
For this notebook, the following dependencies are required:
aisquared
This package is available on on pypi via pip
. The following cell also runs the commands to install this dependency as well as imports them into the notebook environment.
Analytic Creation
Now that the required packages have been installed and imported, it is time to create the results of the analytic. These results are going to be recorded in JSON form via a Python dictionary, with the top-level key being IP address and the lower-level keys being the associated individual's name and customer ID.
Create the Model Configuration
In the following block, we configure the harvesting, preprocessing, analytic, postprocessing, and rendering steps. Once those are created, we add them all to the ModelConfiguration
object and compile them into the .air
file.
Harvesting data from the webpage
Pre- and Post-processing
Analytic
Rendering
Putting it all Together
Now that the pieces are in place, we can put them together into a .air file that is ready to use in the AI Squared Extension.
Try it now!
To try using this analytic without running the Python code, here is a copy of the analytic as a compiled .air file.
Last updated