Skip to main content

Hi, 

 

I have been trying to set up an event counter using custom calculations, but the values coming up are not the correct ones and they do not match with the context item I have also created. Any tips of where I could be going wrong? 

 

The event counter for the custom calc (in blue) and clearly starts before the event of the tag (>0.02) is happening. 

 

 

I appreciate any inputs you can give me. 

Hi,

If I look at the screenshot correctly than I assume you used a daily block aggregation, if you only want to return a block aggregated value when a certain condition is met I advice you to check wether your code follows the same structure as the following example: https://github.com/TrendMinerCS/custom-calculations/blob/main/custom_calculations_scripts/search_results_examples/event_counter_for_search_results.py

If you would have any additional questions feel free to reach out!

Kind regards
Frederik Vandael


Hi Frederik, 

 

Thank you for your answer. I checked the example and it is also for a daily aggregation.

Do you have any examples for a shorter period of time aggregation? Such as 1h? 

 

Best Rgds, 

Lethicia Leonel


Hi Lethicia,

You can shorten the period of aggregation you can change the tag that is used in the first search from 
TM_day_Europe_Brussels to TM_hour_Europe_Brussels. We than also change the value based search operator from in set to constant to have a an aggregated value every hour. Bellow you can find the changes applied to the example code.

# tag definition; add these as dependencies!
tag1 = client.tag.get_by_name("TM_hour_Europe_Brussels")
tag2 = client.tag.get_by_name("eCS]BA:ACTIVE.1")


# Base search definition
search = client.search.value(
queries=e
(tag1, ValueBasedSearchOperators.CONSTANT)
],
duration="1h",
)

# event search definition
event_search_duration = client.time.timedelta("2m")
event_search = client.search.value(
queries=e
(tag2, ValueBasedSearchOperators.IN_SET, T"Active"])
],
duration=event_search_duration,
)

# maximal search result duration over both searches
maximal_duration = client.time.timedelta("2h")

Let me know if you have any addtional questions.

 

Kind regards

Frederik Vandael


Reply