Documentation for eventMonitor Logic
Purpose
The eventMonitor logic module is designed to monitor breaking events in near-real-time, specifically within a 15-minute window. It is optimized for scheduled workflows that periodically check for new event articles. To enhance data quality, the module includes a deduplication feature that avoids returning repeat articles based on their URLs. This component is particularly useful for users requiring timely updates on various topics and themes relevant to their interests or industries.
Settings
The eventMonitor offers several configurable settings to control its behavior and output. Below is a detailed examination of each setting, including its name, input type, purpose, effects of modifying the setting, and default values.
1. query
- Input Type: String
- Description: This setting specifies the search query for monitoring articles. It's critical, as it determines the relevance of the articles fetched. If no query is provided (neither through
confignorinputs), the logic will return an error stating "No monitor query provided." - Default Value: Empty string (
"").
2. timespan
- Input Type: String
- Description: Defines the time window for which articles are searched and monitored. In this case, it defaults to 15 minutes. By changing this value, users can extend or reduce the time span for checking events, which directly affects the recency of returned articles.
- Default Value:
'15min'.
3. maxRecords
- Input Type: Numeric
- Description: Sets the maximum number of articles to return in a single query. A higher value allows for more articles to be fetched, whereas a lower value restricts the output size, impacting data processing efficiency.
- Default Value:
25.
4. sort
- Input Type: String
- Description: Specifies the sort order of the retrieved articles. Currently, it is hardcoded to sort by date in descending order, meaning the most recent articles will be presented first.
- Default Value:
'datedesc'.
5. country
- Input Type: String
- Description: Filters the articles based on their country of origin. This is particularly useful for users who want localized news or events specific to certain regions.
- Default Value: Empty string (
"").
6. theme
- Input Type: String
- Description: This setting allows filtering by thematic relevance, targeting articles in specific domains of interest (e.g., sports, politics). Customizing this will help tailor the content fetched to better meet user needs.
- Default Value: Empty string (
"").
7. domain
- Input Type: String
- Description: Limits the search to specific domains from which articles will be retrieved. This can enhance the relevancy of articles if there are known, trusted sources.
- Default Value: Empty string (
"").
8. language
- Input Type: String
- Description: Filters results based on the language in which the articles are written. This allows users to tailor the output to their preferred language or the languages relevant to their monitoring.
- Default Value: Empty string (
"").
9. deduplicate
- Input Type: Boolean
- Description: Controls whether deduplication of articles is performed based on their URLs. Setting it to
falsedisables the deduplication, allowing for the same article to potentially appear multiple times across different runs, which may be useful for specific use cases where repeated visibility is needed. - Default Value:
true(deduplication enabled).
How It Works
The eventMonitor executes an asynchronous function that defines a searchConfig based on the provided inputs and config. It then checks if a valid query is present; if not, it returns an error. If the query is valid, the function attempts to retrieve articles using the searchArticles service with the specified search configuration.
Once articles are retrieved, deduplication occurs if the deduplicate setting is enabled. Articles without a valid URL or duplicates based on URL are filtered out. Finally, the function returns either the found articles or an indication that no new events were found.
In case of any errors during fetching, the module captures the exception and returns an appropriate error message to the output.
Use Cases & Examples
Use Cases
-
News Aggregation for Businesses: Organizations can utilize
eventMonitorto continuously monitor relevant news articles related to their industry or competitors, enabling rapid response strategies and decision-making. -
Event Detection for Marketing Teams: Marketing departments can track events relevant to their audience, identifying trends and opportunities for targeted campaigns or content creation.
-
Crisis Management Monitoring: Companies can set up monitoring for specific themes like "crisis" or "emergency" to quickly gather information and assess public sentiment during critical events.
Example Configuration
To illustrate a specific use case, let's consider a marketing team wanting to monitor breaking news articles related to the "technology" industry in the last 15 minutes. Below is a sample configuration for eventMonitor.
{
"config": {
"query": "technology",
"timespan": "15min",
"maxRecords": 50,
"country": "US",
"theme": "innovation",
"domain": "techcrunch.com",
"language": "en",
"deduplicate": true
}
}In this configuration:
- The module will retrieve articles focusing on the "technology" industry in English coming from "techcrunch.com".
- It will check every 15 minutes and return a maximum of 50 articles, ensuring recent content is prioritized and duplicates are filtered out.
This configuration example demonstrates how eventMonitor can be tailored to meet specific monitoring needs within a business context.