diff --git a/jpo-conflictvisualizer-api/pom.xml b/jpo-conflictvisualizer-api/pom.xml
index b8b0362a4..657f7ba67 100644
--- a/jpo-conflictvisualizer-api/pom.xml
+++ b/jpo-conflictvisualizer-api/pom.xml
@@ -143,7 +143,7 @@
usdot.jpo.ode
jpo-conflictmonitor
- 1.4.1
+ 1.5.0
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionEventRepository.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionEventRepository.java
new file mode 100644
index 000000000..efe90effb
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionEventRepository.java
@@ -0,0 +1,20 @@
+package us.dot.its.jpo.ode.api.accessors.events.BsmMessageCountProgressionEventRepository;
+
+import java.util.List;
+
+import org.springframework.data.mongodb.core.query.Query;
+import us.dot.its.jpo.ode.api.models.IDCount;
+import us.dot.its.jpo.ode.api.models.DataLoader;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.BsmMessageCountProgressionEvent;
+
+public interface BsmMessageCountProgressionEventRepository extends DataLoader{
+ Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest);
+
+ long getQueryResultCount(Query query);
+
+ long getQueryFullCount(Query query);
+
+ List find(Query query);
+
+ List getBsmBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime);
+}
\ No newline at end of file
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionRepositoryImpl.java
new file mode 100644
index 000000000..b85c7e309
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/BsmMessageCountProgressionEventRepository/BsmMessageCountProgressionRepositoryImpl.java
@@ -0,0 +1,113 @@
+package us.dot.its.jpo.ode.api.accessors.events.BsmMessageCountProgressionEventRepository;
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+
+import org.springframework.data.domain.Sort;
+
+import org.springframework.data.mongodb.core.aggregation.Aggregation;
+import org.springframework.data.mongodb.core.aggregation.AggregationResults;
+import org.springframework.data.mongodb.core.aggregation.DateOperators;
+
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.BsmMessageCountProgressionEvent;
+import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
+import us.dot.its.jpo.ode.api.models.IDCount;
+
+@Component
+public class BsmMessageCountProgressionRepositoryImpl implements BsmMessageCountProgressionEventRepository {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ ConflictMonitorApiProperties props;
+
+ private String collectionName = "CmBsmMessageCountProgressionEvents";
+
+ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest) {
+ Query query = new Query();
+
+ if (intersectionID != null) {
+ query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
+ }
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ query.addCriteria(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate));
+ if (latest) {
+ query.with(Sort.by(Sort.Direction.DESC, "eventGeneratedAt"));
+ query.limit(1);
+ }else{
+ query.limit(props.getMaximumResponseSize());
+ }
+ return query;
+ }
+
+ public long getQueryResultCount(Query query) {
+ return mongoTemplate.count(query, BsmMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public long getQueryFullCount(Query query){
+ int limit = query.getLimit();
+ query.limit(-1);
+ long count = mongoTemplate.count(query, BsmMessageCountProgressionEvent.class, collectionName);
+ query.limit(limit);
+ return count;
+ }
+
+ public List find(Query query) {
+ return mongoTemplate.find(query, BsmMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public List getBsmMessageCountProgressionEventsByDay(int intersectionID, Long startTime, Long endTime){
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ Aggregation aggregation = Aggregation.newAggregation(
+ Aggregation.match(Criteria.where("intersectionID").is(intersectionID)),
+ Aggregation.match(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate)),
+ Aggregation.project()
+ .and(DateOperators.DateToString.dateOf("eventGeneratedAt").toString("%Y-%m-%d")).as("dateStr"),
+ Aggregation.group("dateStr").count().as("count")
+ );
+
+ AggregationResults result = mongoTemplate.aggregate(aggregation, collectionName, IDCount.class);
+ List results = result.getMappedResults();
+
+ return results;
+ }
+
+ @Override
+ public void add(BsmMessageCountProgressionEvent item) {
+ mongoTemplate.save(item, collectionName);
+ }
+
+ @Override
+ public List getBsmBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getBsmBroadcastRateEventsByDay'");
+ }
+
+
+}
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionEventRepository.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionEventRepository.java
new file mode 100644
index 000000000..a80ded2b5
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionEventRepository.java
@@ -0,0 +1,20 @@
+package us.dot.its.jpo.ode.api.accessors.events.MapMessageCountProgressionEventRepository;
+
+import java.util.List;
+
+import org.springframework.data.mongodb.core.query.Query;
+import us.dot.its.jpo.ode.api.models.IDCount;
+import us.dot.its.jpo.ode.api.models.DataLoader;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.MapMessageCountProgressionEvent;
+
+public interface MapMessageCountProgressionEventRepository extends DataLoader{
+ Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest);
+
+ long getQueryResultCount(Query query);
+
+ long getQueryFullCount(Query query);
+
+ List find(Query query);
+
+ List getMapBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime);
+}
\ No newline at end of file
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionRepositoryImpl.java
new file mode 100644
index 000000000..fc80d7d6b
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/MapMessageCountProgressionEventRepository/MapMessageCountProgressionRepositoryImpl.java
@@ -0,0 +1,114 @@
+package us.dot.its.jpo.ode.api.accessors.events.MapMessageCountProgressionEventRepository;
+
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+
+import org.springframework.data.domain.Sort;
+
+import org.springframework.data.mongodb.core.aggregation.Aggregation;
+import org.springframework.data.mongodb.core.aggregation.AggregationResults;
+import org.springframework.data.mongodb.core.aggregation.DateOperators;
+
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.MapMessageCountProgressionEvent;
+import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
+import us.dot.its.jpo.ode.api.models.IDCount;
+
+@Component
+public class MapMessageCountProgressionRepositoryImpl implements MapMessageCountProgressionEventRepository {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ ConflictMonitorApiProperties props;
+
+ private String collectionName = "CmMapMessageCountProgressionEvents";
+
+ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest) {
+ Query query = new Query();
+
+ if (intersectionID != null) {
+ query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
+ }
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ query.addCriteria(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate));
+ if (latest) {
+ query.with(Sort.by(Sort.Direction.DESC, "eventGeneratedAt"));
+ query.limit(1);
+ }else{
+ query.limit(props.getMaximumResponseSize());
+ }
+ return query;
+ }
+
+ public long getQueryResultCount(Query query) {
+ return mongoTemplate.count(query, MapMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public long getQueryFullCount(Query query){
+ int limit = query.getLimit();
+ query.limit(-1);
+ long count = mongoTemplate.count(query, MapMessageCountProgressionEvent.class, collectionName);
+ query.limit(limit);
+ return count;
+ }
+
+ public List find(Query query) {
+ return mongoTemplate.find(query, MapMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public List getMapMessageCountProgressionEventsByDay(int intersectionID, Long startTime, Long endTime){
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ Aggregation aggregation = Aggregation.newAggregation(
+ Aggregation.match(Criteria.where("intersectionID").is(intersectionID)),
+ Aggregation.match(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate)),
+ Aggregation.project()
+ .and(DateOperators.DateToString.dateOf("eventGeneratedAt").toString("%Y-%m-%d")).as("dateStr"),
+ Aggregation.group("dateStr").count().as("count")
+ );
+
+ AggregationResults result = mongoTemplate.aggregate(aggregation, collectionName, IDCount.class);
+ List results = result.getMappedResults();
+
+ return results;
+ }
+
+ @Override
+ public void add(MapMessageCountProgressionEvent item) {
+ mongoTemplate.save(item, collectionName);
+ }
+
+ @Override
+ public List getMapBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getMapBroadcastRateEventsByDay'");
+ }
+
+
+}
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionEventRepository.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionEventRepository.java
new file mode 100644
index 000000000..ea1d9e43a
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionEventRepository.java
@@ -0,0 +1,21 @@
+package us.dot.its.jpo.ode.api.accessors.events.SpatMessageCountProgressionEvent;
+
+
+import java.util.List;
+
+import org.springframework.data.mongodb.core.query.Query;
+import us.dot.its.jpo.ode.api.models.IDCount;
+import us.dot.its.jpo.ode.api.models.DataLoader;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.SpatMessageCountProgressionEvent;
+
+public interface SpatMessageCountProgressionEventRepository extends DataLoader{
+ Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest);
+
+ long getQueryResultCount(Query query);
+
+ long getQueryFullCount(Query query);
+
+ List find(Query query);
+
+ List getSpatBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime);
+}
\ No newline at end of file
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionRepositoryImpl.java
new file mode 100644
index 000000000..12bcc1b29
--- /dev/null
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/events/SpatMessageCountProgressionEvent/SpatMessageCountProgressionRepositoryImpl.java
@@ -0,0 +1,114 @@
+package us.dot.its.jpo.ode.api.accessors.events.SpatMessageCountProgressionEvent;
+
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Component;
+
+
+import org.springframework.data.domain.Sort;
+
+import org.springframework.data.mongodb.core.aggregation.Aggregation;
+import org.springframework.data.mongodb.core.aggregation.AggregationResults;
+import org.springframework.data.mongodb.core.aggregation.DateOperators;
+
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.SpatMessageCountProgressionEvent;
+import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
+import us.dot.its.jpo.ode.api.models.IDCount;
+
+@Component
+public class SpatMessageCountProgressionRepositoryImpl implements SpatMessageCountProgressionEventRepository {
+
+ @Autowired
+ private MongoTemplate mongoTemplate;
+
+ @Autowired
+ ConflictMonitorApiProperties props;
+
+ private String collectionName = "CmSpatMessageCountProgressionEvents";
+
+ public Query getQuery(Integer intersectionID, Long startTime, Long endTime, boolean latest) {
+ Query query = new Query();
+
+ if (intersectionID != null) {
+ query.addCriteria(Criteria.where("intersectionID").is(intersectionID));
+ }
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ query.addCriteria(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate));
+ if (latest) {
+ query.with(Sort.by(Sort.Direction.DESC, "eventGeneratedAt"));
+ query.limit(1);
+ }else{
+ query.limit(props.getMaximumResponseSize());
+ }
+ return query;
+ }
+
+ public long getQueryResultCount(Query query) {
+ return mongoTemplate.count(query, SpatMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public long getQueryFullCount(Query query){
+ int limit = query.getLimit();
+ query.limit(-1);
+ long count = mongoTemplate.count(query, SpatMessageCountProgressionEvent.class, collectionName);
+ query.limit(limit);
+ return count;
+ }
+
+ public List find(Query query) {
+ return mongoTemplate.find(query, SpatMessageCountProgressionEvent.class, collectionName);
+ }
+
+ public List getSpatMessageCountProgressionEventsByDay(int intersectionID, Long startTime, Long endTime){
+ Date startTimeDate = new Date(0);
+ Date endTimeDate = new Date();
+
+ if (startTime != null) {
+ startTimeDate = new Date(startTime);
+ }
+ if (endTime != null) {
+ endTimeDate = new Date(endTime);
+ }
+
+ Aggregation aggregation = Aggregation.newAggregation(
+ Aggregation.match(Criteria.where("intersectionID").is(intersectionID)),
+ Aggregation.match(Criteria.where("eventGeneratedAt").gte(startTimeDate).lte(endTimeDate)),
+ Aggregation.project()
+ .and(DateOperators.DateToString.dateOf("eventGeneratedAt").toString("%Y-%m-%d")).as("dateStr"),
+ Aggregation.group("dateStr").count().as("count")
+ );
+
+ AggregationResults result = mongoTemplate.aggregate(aggregation, collectionName, IDCount.class);
+ List results = result.getMappedResults();
+
+ return results;
+ }
+
+ @Override
+ public void add(SpatMessageCountProgressionEvent item) {
+ mongoTemplate.save(item, collectionName);
+ }
+
+ @Override
+ public List getSpatBroadcastRateEventsByDay(int intersectionID, Long startTime, Long endTime) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("Unimplemented method 'getSpatBroadcastRateEventsByDay'");
+ }
+
+
+}
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/EventController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/EventController.java
index 875d7659c..802daf187 100644
--- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/EventController.java
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/EventController.java
@@ -26,11 +26,14 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import us.dot.its.jpo.conflictmonitor.monitor.models.bsm.BsmEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.BsmMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.ConnectionOfTravelEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.IntersectionReferenceAlignmentEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.LaneDirectionOfTravelEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.MapMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalGroupAlignmentEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalStateConflictEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.SpatMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLinePassageEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLineStopEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.TimeChangeDetailsEvent;
@@ -40,16 +43,19 @@
import us.dot.its.jpo.conflictmonitor.monitor.models.events.minimum_data.SpatMinimumDataEvent;
import us.dot.its.jpo.ode.api.ConflictMonitorApiProperties;
import us.dot.its.jpo.ode.api.accessors.events.BsmEvent.BsmEventRepository;
+import us.dot.its.jpo.ode.api.accessors.events.BsmMessageCountProgressionEventRepository.BsmMessageCountProgressionEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.ConnectionOfTravelEvent.ConnectionOfTravelEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.IntersectionReferenceAlignmentEvent.IntersectionReferenceAlignmentEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.LaneDirectionOfTravelEvent.LaneDirectionOfTravelEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.MapBroadcastRateEvents.MapBroadcastRateEventRepository;
+import us.dot.its.jpo.ode.api.accessors.events.MapMessageCountProgressionEventRepository.MapMessageCountProgressionEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.MapMinimumDataEvent.MapMinimumDataEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SignalGroupAlignmentEvent.SignalGroupAlignmentEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SignalStateConflictEvent.SignalStateConflictEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SignalStateEvent.SignalStateEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SignalStateStopEvent.SignalStateStopEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SpatBroadcastRateEvent.SpatBroadcastRateEventRepository;
+import us.dot.its.jpo.ode.api.accessors.events.SpatMessageCountProgressionEvent.SpatMessageCountProgressionEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.SpatMinimumDataEvent.SpatMinimumDataEventRepository;
import us.dot.its.jpo.ode.api.accessors.events.TimeChangeDetailsEvent.TimeChangeDetailsEventRepository;
import us.dot.its.jpo.ode.api.models.IDCount;
@@ -97,6 +103,15 @@ public class EventController {
@Autowired
MapBroadcastRateEventRepository mapBroadcastRateEventRepo;
+ @Autowired
+ SpatMessageCountProgressionEventRepository spatMessageCountProgressionEventRepo;
+
+ @Autowired
+ MapMessageCountProgressionEventRepository mapMessageCountProgressionEventRepo;
+
+ @Autowired
+ BsmMessageCountProgressionEventRepository bsmMessageCountProgressionEventRepo;
+
@Autowired
BsmEventRepository bsmEventRepo;
@@ -818,6 +833,158 @@ public ResponseEntity countSpatBroadcastRateEvents(
}
}
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/spat_message_count_progression", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity> findSpatMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ List list = new ArrayList<>();
+ list.add(MockEventGenerator.getSpatMessageCountProgressionEvent());
+ return ResponseEntity.ok(list);
+ } else {
+ Query query = spatMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, latest);
+ long count = spatMessageCountProgressionEventRepo.getQueryResultCount(query);
+ logger.info("Returning SpatMinimumDataEventRepo Response with Size: " + count);
+ return ResponseEntity.ok(spatMessageCountProgressionEventRepo.find(query));
+ }
+ }
+
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/spat_message_count_progression/count", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity countSpatMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "full_count", required = false, defaultValue = "true") boolean fullCount,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ return ResponseEntity.ok(1L);
+ } else {
+ Query query = spatMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, false);
+
+ long count = 0;
+
+ if(fullCount){
+ count = spatMessageCountProgressionEventRepo.getQueryFullCount(query);
+ }else{
+ count = spatMessageCountProgressionEventRepo.getQueryResultCount(query);
+ }
+
+ logger.info("Found: " + count + " SPaT message Count Progression Events");
+ return ResponseEntity.ok(count);
+ }
+ }
+
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/map_message_count_progression", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity> findMapMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ List list = new ArrayList<>();
+ list.add(MockEventGenerator.getMapMessageCountProgressionEvent());
+ return ResponseEntity.ok(list);
+ } else {
+ Query query = mapMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, latest);
+ long count = mapMessageCountProgressionEventRepo.getQueryResultCount(query);
+ logger.info("Returning MapMinimumDataEventRepo Response with Size: " + count);
+ return ResponseEntity.ok(mapMessageCountProgressionEventRepo.find(query));
+ }
+ }
+
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/map_message_count_progression/count", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity countMapMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "full_count", required = false, defaultValue = "true") boolean fullCount,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ return ResponseEntity.ok(1L);
+ } else {
+ Query query = mapMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, false);
+
+ long count = 0;
+
+ if(fullCount){
+ count = mapMessageCountProgressionEventRepo.getQueryFullCount(query);
+ }else{
+ count = mapMessageCountProgressionEventRepo.getQueryResultCount(query);
+ }
+
+ logger.info("Found: " + count + " SPaT message Count Progression Events");
+ return ResponseEntity.ok(count);
+ }
+ }
+
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/bsm_message_count_progression", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity> findBsmMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "latest", required = false, defaultValue = "false") boolean latest,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ List list = new ArrayList<>();
+ list.add(MockEventGenerator.getBsmMessageCountProgressionEvent());
+ return ResponseEntity.ok(list);
+ } else {
+ Query query = bsmMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, latest);
+ long count = bsmMessageCountProgressionEventRepo.getQueryResultCount(query);
+ logger.info("Returning BsmMinimumDataEventRepo Response with Size: " + count);
+ return ResponseEntity.ok(bsmMessageCountProgressionEventRepo.find(query));
+ }
+ }
+
+ @CrossOrigin(origins = "http://localhost:3000")
+ @RequestMapping(value = "/events/bsm_message_count_progression/count", method = RequestMethod.GET, produces = "application/json")
+ @PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
+ public ResponseEntity countBsmMessageCountProgressionEvents(
+ @RequestParam(name = "intersection_id", required = false) Integer intersectionID,
+ @RequestParam(name = "start_time_utc_millis", required = false) Long startTime,
+ @RequestParam(name = "end_time_utc_millis", required = false) Long endTime,
+ @RequestParam(name = "full_count", required = false, defaultValue = "true") boolean fullCount,
+ @RequestParam(name = "test", required = false, defaultValue = "false") boolean testData) {
+
+ if (testData) {
+ return ResponseEntity.ok(1L);
+ } else {
+ Query query = bsmMessageCountProgressionEventRepo.getQuery(intersectionID, startTime, endTime, false);
+
+ long count = 0;
+
+ if(fullCount){
+ count = bsmMessageCountProgressionEventRepo.getQueryFullCount(query);
+ }else{
+ count = bsmMessageCountProgressionEventRepo.getQueryResultCount(query);
+ }
+
+ logger.info("Found: " + count + " SPaT message Count Progression Events");
+ return ResponseEntity.ok(count);
+ }
+ }
+
+
+
@CrossOrigin(origins = "http://localhost:3000")
@RequestMapping(value = "/events/bsm_events", method = RequestMethod.GET, produces = "application/json")
@PreAuthorize("hasRole('USER') || hasRole('ADMIN')")
diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java
index ceb8bb690..c25e89c80 100644
--- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java
+++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/mockdata/MockEventGenerator.java
@@ -2,6 +2,7 @@
import java.time.Instant;
import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
@@ -9,12 +10,15 @@
import us.dot.its.jpo.conflictmonitor.monitor.models.RegulatorIntersectionId;
import us.dot.its.jpo.conflictmonitor.monitor.models.bsm.BsmEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.BsmMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.ConnectionOfTravelEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.IntersectionReferenceAlignmentEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.LaneDirectionOfTravelEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.MapMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.ProcessingTimePeriod;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalGroupAlignmentEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.SignalStateConflictEvent;
+import us.dot.its.jpo.conflictmonitor.monitor.models.events.SpatMessageCountProgressionEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLinePassageEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.StopLineStopEvent;
import us.dot.its.jpo.conflictmonitor.monitor.models.events.TimeChangeDetailsEvent;
@@ -179,6 +183,40 @@ public static MapBroadcastRateEvent getMapBroadcastRateEvent() {
return event;
}
+ public static SpatMessageCountProgressionEvent getSpatMessageCountProgressionEvent() {
+ SpatMessageCountProgressionEvent event = new SpatMessageCountProgressionEvent();
+ event.setIntersectionID(12109);
+ event.setTimestampA(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setTimestampB(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setMessageType("SPaT");
+ event.setMessageCountA(0);
+ event.setMessageCountB(1);
+ return event;
+ }
+
+ public static MapMessageCountProgressionEvent getMapMessageCountProgressionEvent() {
+ MapMessageCountProgressionEvent event = new MapMessageCountProgressionEvent();
+ event.setIntersectionID(12109);
+ event.setTimestampA(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setTimestampB(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setMessageType("MAP");
+ event.setMessageCountA(0);
+ event.setMessageCountB(1);
+ return event;
+ }
+
+ public static BsmMessageCountProgressionEvent getBsmMessageCountProgressionEvent() {
+ BsmMessageCountProgressionEvent event = new BsmMessageCountProgressionEvent();
+ event.setIntersectionID(12109);
+ event.setTimestampA(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setTimestampB(ZonedDateTime.now().format(DateTimeFormatter.ISO_DATE));
+ event.setMessageType("BSM");
+ event.setMessageCountA(0);
+ event.setMessageCountB(1);
+ event.setVehicleId("123ABC");
+ return event;
+ }
+
public static BsmEvent getBsmEvent() {
BsmEvent event = new BsmEvent();
event.setIntersectionID(12109);