Package edu.tufts.hrilab.ava.stats
Class AvaStatisticsManagerComponent
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.ava.stats.AvaStatisticsManagerComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringStatistic IDs exposed to dialogue; order matches list shown to user (option 1, 2, ...).static final StringFields inherited from class edu.tufts.hrilab.diarc.DiarcComponent
executionLoopCycleTime, log, shouldRunExecutionLoop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTRADE service name is unique so GoalViewerAdapter.getAvailableService("handleGoalNotification") stays unique.createStatisticsReportPredicate(String statisticId, String startDateStr, String endDateStr, double value) Builds the full statisticsReport predicate for the language system: statisticsReport(statId, startDate, endDate, valueTerm) with valueTerm as a structured predicate (duration(...), distance(...), count(...)).createStatisticsReportPredicateWithValueTerm(String statisticId, String startDateStr, String endDateStr, Symbol valueTerm) Builds statisticsReport with an arbitrary value term (e.g.createStatisticValueTerm(String statisticId, double value) Builds the value term for a statistic report: duration(...) for time_off_dock, distance(value, meters) for distance_traveled, count(N) for counts.Returns statistic IDs in display order (option 1, 2, ...Category names in the order they should be announced (Mobility, Goals, Battery, Media).getLeastFailedGoalReport(long startMs, long endMs, String startDateStr, String endDateStr) getLocationsVisitedCountReport(long startMs, long endMs, String startDateStr, String endDateStr) getMostCanceledGoalReport(long startMs, long endMs, String startDateStr, String endDateStr) getMostFailedGoalReport(long startMs, long endMs, String startDateStr, String endDateStr) getMostFrequentEscortDestinationReport(long startMs, long endMs, String startDateStr, String endDateStr) getMostVisitedLocationReport(long startMs, long endMs, String startDateStr, String endDateStr) getStatisticDisplayName(String statisticId) getStatisticIdsInCategory(String category) Statistic IDs in the given category (for grouped listing).getStatisticsReportPredicate(String statisticId, long startMs, long endMs, String startDateStr, String endDateStr) Returns the report predicate for the given statistic over the period, for use with generateResponse.protected voidinit()Perform any component initialization.voidvoidonGoalManagerRegistrationAvailable(ai.thinkingrobots.trade.TRADEServiceInfo registerService) Called by TRADE when registerGoalManagerNotification becomes available (now or when joined).longparseDateToEndMs(String dateStr) Parses a date string (YYYY-MM-DD) to end-of-day epoch ms in system default timezone.longparseDateToStartMs(String dateStr) Parses a date string (YYYY-MM-DD) to start-of-day epoch ms in system default timezone.protected voiddoublequeryStatistics(String statisticId, long startMs, long endMs) Queries the statistics CSV for the given statistic over [startMs, endMs] (inclusive).voidRecords an event to the statistics CSV.voidregisterAvaStatisticsCallback(ai.thinkingrobots.trade.TRADEServiceInfo service) Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
additionalUsageInfo, attachShutdownHook, createInstance, createInstance, createInstance, executionLoop, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, main, parseArgs, shutdown, shutdownComponent
-
Field Details
-
STAT_TIME_OFF_DOCK
Statistic IDs exposed to dialogue; order matches list shown to user (option 1, 2, ...).- See Also:
-
STAT_DISTANCE_TRAVELED
- See Also:
-
STAT_TOURS_EXECUTED
- See Also:
-
STAT_SCHEDULED_GOAL_EXECUTIONS
- See Also:
-
STAT_LOW_BATTERY_DOCK_EXECUTIONS
- See Also:
-
STAT_GOALS_COMPLETED
- See Also:
-
STAT_GOALS_FAILED
- See Also:
-
STAT_GOALS_CANCELED
- See Also:
-
STAT_AVERAGE_UNDOCKED_BATTERY
- See Also:
-
STAT_MEDIA_PLAYBACK_TOTAL
- See Also:
-
STAT_MEDIA_PLAYBACK_PHOTOS
- See Also:
-
STAT_MEDIA_PLAYBACK_VIDEOS
- See Also:
-
STAT_ESCORTS_COMPLETED
- See Also:
-
STAT_ESCORTS_FAILED
- See Also:
-
STAT_ESCORTS_CANCELED
- See Also:
-
STAT_DELIVERIES_COMPLETED
- See Also:
-
STAT_MOST_FREQUENTLY_FAILED
- See Also:
-
STAT_LEAST_FREQUENTLY_FAILED
- See Also:
-
STAT_MOST_FREQUENTLY_CANCELED
- See Also:
-
STAT_MOST_VISITED_LOCATION
- See Also:
-
STAT_LOCATIONS_VISITED_COUNT
- See Also:
-
STAT_MOST_FREQUENT_ESCORT_DESTINATION
- See Also:
-
STAT_KIOSK_GOAL_TRIGGERS
- See Also:
-
-
Constructor Details
-
AvaStatisticsManagerComponent
public AvaStatisticsManagerComponent()
-
-
Method Details
-
init
protected void init()Description copied from class:DiarcComponentPerform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.- Overrides:
initin classDiarcComponent
-
postRegistrationInit
protected void postRegistrationInit()- Overrides:
postRegistrationInitin classDiarcComponent
-
onGoalManagerRegistrationAvailable
public void onGoalManagerRegistrationAvailable(ai.thinkingrobots.trade.TRADEServiceInfo registerService) throws ai.thinkingrobots.trade.TRADEException Called by TRADE when registerGoalManagerNotification becomes available (now or when joined). Registers our callback for GOAL_STATUS_CHANGE notifications.- Throws:
ai.thinkingrobots.trade.TRADEException
-
avaStatisticsGoalNotification
public void avaStatisticsGoalNotification(GoalInfo info) throws ai.thinkingrobots.trade.TRADEException TRADE service name is unique so GoalViewerAdapter.getAvailableService("handleGoalNotification") stays unique.- Throws:
ai.thinkingrobots.trade.TRADEException
-
registerAvaStatisticsCallback
public void registerAvaStatisticsCallback(ai.thinkingrobots.trade.TRADEServiceInfo service) -
recordAvaStatisticsEvent
Records an event to the statistics CSV. Any component (e.g. AvaDisplayComponent) can call this to log MEDIA_PLAYBACK or other events without registering with AvaComponent. -
onAvaStatisticsEvent
-
getAvailableStatisticIds
Returns statistic IDs in display order (option 1, 2, ... for list+option flow), grouped by category so ASL can list by section. -
getCategoryNamesInOrder
Category names in the order they should be announced (Mobility, Goals, Battery, Media). -
getStatisticIdsInCategory
Statistic IDs in the given category (for grouped listing). -
getStatisticDisplayName
-
createStatisticValueTerm
Builds the value term for a statistic report: duration(...) for time_off_dock, distance(value, meters) for distance_traveled, count(N) for counts. Matches AVA patterns (period(number, timeUnit), etc.). -
createStatisticsReportPredicate
public Predicate createStatisticsReportPredicate(String statisticId, String startDateStr, String endDateStr, double value) Builds the full statisticsReport predicate for the language system: statisticsReport(statId, startDate, endDate, valueTerm) with valueTerm as a structured predicate (duration(...), distance(...), count(...)). -
createStatisticsReportPredicateWithValueTerm
public Predicate createStatisticsReportPredicateWithValueTerm(String statisticId, String startDateStr, String endDateStr, Symbol valueTerm) Builds statisticsReport with an arbitrary value term (e.g. mostFailedGoals(goal1, goal2, count(N)) for ties; last arg is always count). Use so RR can resolve refs inside the value term when generateResponse(predicate) is used. -
getStatisticsReportPredicate
public Predicate getStatisticsReportPredicate(String statisticId, long startMs, long endMs, String startDateStr, String endDateStr) Returns the report predicate for the given statistic over the period, for use with generateResponse. For numeric stats: queries the value and builds the report predicate. For drill-down/location stats: builds the report predicate from aggregated data. Returns null if no data for that statistic in that period. -
parseDateToStartMs
Parses a date string (YYYY-MM-DD) to start-of-day epoch ms in system default timezone. Inclusive start for analysis period. -
parseDateToEndMs
Parses a date string (YYYY-MM-DD) to end-of-day epoch ms in system default timezone. Inclusive end for analysis period. -
queryStatistics
Queries the statistics CSV for the given statistic over [startMs, endMs] (inclusive). Returns a numeric value: counts as whole number (e.g. 10.0), time off dock in minutes, distance in meters, average battery 0-100, media playback in minutes. -
getMostFailedGoalReport
-
getLeastFailedGoalReport
-
getMostCanceledGoalReport
-
getMostVisitedLocationReport
-
getLocationsVisitedCountReport
-
getMostFrequentEscortDestinationReport
-