Zeotap Intern Assignment
Zeotap Intern Assignment
Objective:
Develop a simple 3-tier rule engine application(Simple UI, API and Backend, Data) to determine
user eligibility based on attributes like age, department, income, spend etc.The system can use
Abstract Syntax Tree (AST) to represent conditional rules and allow for dynamic
creation,combination, and modification of these rules.
Data Structure:
Data Storage
● Define the choice of database for storing the above rules and application metadata
● Define the schema with samples.
Sample Rules:
API Design:
Test Cases:
1. Create individual rules from the examples using create_rule and verify their AST
representation.
2. Combine the example rules using combine_rules and ensure the resulting AST
reflects the combined logic.
3. Implement sample JSON data and test evaluate_rule for different scenarios.
4. Explore combining additional rules and test the functionality.
Bonus:
● Implement error handling for invalid rule strings or data formats (e.g., missing operators,
invalid comparisons).
● Implement validations for attributes to be part of a catalog.
● Allow for modification of existing rules using additional functionalities within
create_rule or separate functions.This could involve changing operators, operand
values, or adding/removing sub-expressions within the AST.
● Consider extending the system to support user-defined functions within the rule
language for advanced conditions (outside the scope of this exercise).
Develop a real-time data processing system to monitor weather conditions and provide
summarized insights using rollups and aggregates. The system will utilize data from the
OpenWeatherMap API (https://openweathermap.org/).
Data Source:
The system will continuously retrieve weather data from the OpenWeatherMap API. You will
need to sign up for a free API key to access the data. The API provides various weather
parameters, and for this assignment, we will focus on:
● main: Main weather condition (e.g., Rain, Snow, Clear)
● temp: Current temperature in Centigrade
● feels_like: Perceived temperature in Centigrade
● dt: Time of the data update (Unix timestamp)
● The system should continuously call the OpenWeatherMap API at a configurable interval
(e.g., every 5 minutes) to retrieve real-time weather data for the metros in India. (Delhi,
Mumbai, Chennai, Bangalore, Kolkata, Hyderabad)
● For each received weather update:
○ Convert temperature values from Kelvin to Celsius (tip : you can also use user
preference).
Test Cases:
1. System Setup:
○ Verify system starts successfully and connects to the OpenWeatherMap API
using a valid API key.
2. Data Retrieval:
○ Simulate API calls at configurable intervals.
○ Ensure the system retrieves weather data for the specified location and parses
the response correctly.
3. Temperature Conversion:
○ Test conversion of temperature values from Kelvin to Celsius (or Fahrenheit)
based on user preference.
4. Daily Weather Summary:
○ Simulate a sequence of weather updates for several days.
○ Verify that daily summaries are calculated correctly, including average, maximum,
minimum temperatures,and dominant weather condition.
5. Alerting Thresholds:
○ Define and configure user thresholds for temperature or weather conditions.
○ Simulate weather data exceeding or breaching the thresholds.
○ Verify that alerts are triggered only when a threshold is violated.
Bonus:
● Extend the system to support additional weather parameters from the OpenWeatherMap
API (e.g., humidity, wind speed) and incorporate them into rollups/aggregates.
● Explore functionalities like weather forecasts retrieval and generating summaries based
on predicted conditions.
Evaluation: