Skip to content

Commit

Permalink
Remove camsys-apps.com repo and dependency on onebusaway-cloud-api
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Dec 7, 2024
1 parent c148b56 commit ca6fc03
Show file tree
Hide file tree
Showing 21 changed files with 4 additions and 372 deletions.
14 changes: 0 additions & 14 deletions onebusaway-gtfs-transformer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<name>Check central first to avoid a lot of not found warnings</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>releases-camsys-public-repo</id>
<url>https://repo.camsys-apps.com/releases/</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -55,16 +51,6 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-cloud-api</artifactId>
<version>${onebusaway.cloud.version}</version>
</dependency>
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-cloud-noop</artifactId>
<version>${onebusaway.cloud.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ else if (opType.equals("count_and_test_bus")) {
else if (opType.equals("count_and_test_subway")) {
handleTransformOperation(line, json, new CountAndTestSubway());
}
else if (opType.equals("verify_route_service")) {
handleTransformOperation(line, json, new VerifyRouteService());
}
else if (opType.equals("verify_bus_service")) {
handleTransformOperation(line, json, new VerifyBusService());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.csv_entities.CSVLibrary;
import org.onebusaway.csv_entities.CSVListener;
import org.onebusaway.csv_entities.schema.annotations.CsvField;
Expand Down Expand Up @@ -110,8 +108,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao){
}


ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();

String[] days = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday","Holiday"};


Expand Down Expand Up @@ -145,9 +141,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao){
_log.info(dateDay + " has " + tripCount + " trips, and we are ignoring this possible anomoly");
} else {
_log.info(dateDay + " has " + tripCount + " trips, this may indicate a problem.");
if (!silentMode) {
es.publishMessage(CloudContextService.getTopic(), dateDay.toString() + " has " + tripCount + " trips, this may indicate a problem.");
}
}
}
dayCounter ++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.csv_entities.schema.annotations.CsvField;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.model.calendar.ServiceDate;
Expand Down Expand Up @@ -59,7 +57,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
Date dayAfterNext = helper.removeTime(helper.addDays(new Date(), 3));

String feed = CloudContextService.getLikelyFeedName(dao);
ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
String agency = dao.getAllAgencies().iterator().next().getId();
String agencyName = dao.getAllAgencies().iterator().next().getName();

Expand All @@ -69,10 +66,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
tripsDayAfterNext = hasServiceForDate(dao, dayAfterNext);

_log.info("Feed for metrics: {}, agency id: {}", feed, agencyName);
es.publishMetric(CloudContextService.getNamespace(), "TripsToday", "feed", feed, tripsToday);
es.publishMetric(CloudContextService.getNamespace(), "TripsTomorrow", "feed", feed, tripsTomorrow);
es.publishMetric(CloudContextService.getNamespace(), "TripsIn2Days", "feed", feed, tripsNextDay);
es.publishMetric(CloudContextService.getNamespace(), "TripsIn3Days", "feed", feed, tripsDayAfterNext);

_log.info("TripsToday: {}, feed: {}, namespace: {}", tripsToday, feed, CloudContextService.getNamespace());
_log.info("TripsTomorrow: {}, feed: {}, namespace: {}", tripsTomorrow, feed, CloudContextService.getNamespace());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.services.GtfsMutableRelationalDao;
import org.onebusaway.gtfs_transformer.services.CloudContextService;
import org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy;
import org.onebusaway.gtfs_transformer.services.TransformContext;
import org.slf4j.Logger;
Expand All @@ -41,8 +38,6 @@ public String getName() {

@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao) {
String feed = CloudContextService.getLikelyFeedName(dao);
ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
RemoveEntityLibrary removeEntityLibrary = new RemoveEntityLibrary();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Set<Trip> stopsWarn = new HashSet<Trip>();
Expand Down Expand Up @@ -101,14 +96,12 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
stopsWarn.size() + ".\n Here are the trips and stops: " + collectedWarnString.substring(2);
_log.info(collectedWarnString);
}
es.publishMetric(CloudContextService.getNamespace(), "TripsWith1-3HrTransitTime", "feed", feed, stopsWarn.size());
if (stopsRemove.size() > 0) {
collectedRemoveString = "Total number of trips with transit times of greater than three hours: " +
stopsRemove.size() + ".\n These trips are being removed. \nTrips being removed: " +
collectedRemoveString.substring(2);
_log.info(collectedRemoveString);
}
es.publishMetric(CloudContextService.getNamespace(), "TripsWithRemovedForTransitTime", "feed", feed, stopsRemove.size());
for (Trip trip: stopsRemove){
removeEntityLibrary.removeTrip(dao, trip);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.csv_entities.schema.annotations.CsvField;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.model.calendar.ServiceDate;
Expand Down Expand Up @@ -64,7 +62,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao gtfsDao) {
defaultAgencyId = CloudContextService.getLikelyFeedName(gtfsDao);
String summaryTopic = CloudContextService.getTopic() + "-atis-summary";
String detailTopic = CloudContextService.getTopic() + "-atis-detail";
ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();

String summaryHeader = "depot,unmatched_gtfs_trips,unmatched_reference_trips\n";
String detailHeader = "depot,unmatched_gtfs_trip_ds,unmatched_reference_trip_ids\n";
Expand Down Expand Up @@ -126,8 +123,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao gtfsDao) {
String time = lpad(cal.get(Calendar.HOUR_OF_DAY), 2) + ":" + lpad(cal.get(Calendar.MINUTE),2 );
String baseurl = s3BasePath
+ "/" + year + "/" + month + "/" + day + "/" + time + "-";
es.putFile(baseurl + "summary.csv", summaryFilename);
es.putFile(baseurl + "detail.csv", detailFilename);


_log.error("{} Unmatched Summary", getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.model.calendar.ServiceDate;
import org.onebusaway.gtfs.services.GtfsMutableRelationalDao;
Expand Down Expand Up @@ -154,15 +152,13 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
dao.getAllTrips().size(), curSerTrips, dao.getAllStops().size(),
dao.getAllStopTimes().size(), countSt, countNoSt, countNoHs);

ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
String feed = CloudContextService.getLikelyFeedName(dao);

HashSet<String> ids = new HashSet<String>();
for (Stop stop : dao.getAllStops()) {
//check for duplicate stop ids.
if (ids.contains(stop.getId().getId())) {
_log.error("Duplicate stop ids! Agency {} stop id {}", agency, stop.getId().getId());
es.publishMultiDimensionalMetric(CloudContextService.getNamespace(),"DuplicateStopIds", new String[]{"feed","stopId"}, new String[] {feed,stop.getId().toString()},1);
throw new IllegalStateException(
"There are duplicate stop ids!");
}
Expand All @@ -172,11 +168,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
}


es.publishMetric(CloudContextService.getNamespace(),"TripsInServiceToday","feed", feed,curSerTrips);
es.publishMetric(CloudContextService.getNamespace(),"TripsInServiceTomorrow","feed", feed,tomSerTrips);



if (curSerTrips + tomSerTrips < 1) {
throw new IllegalStateException(
"There is no current service!!");
Expand All @@ -185,7 +176,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
if (countNoHs > 0) {
_log.error("There are trips with no headsign");
}
es.publishMetric(CloudContextService.getNamespace(), "TripsWithoutHeadsigns", "feed", feed, countNoHs);
}

private Date removeTime(Date date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.gtfs.impl.calendar.CalendarServiceDataFactoryImpl;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.model.calendar.ServiceDate;
Expand Down Expand Up @@ -241,43 +239,23 @@ else if (refTrip.getId().getId().contains("H9")) {
}
_log.info("ATIS Stops: {}, Reference: {}, ATIS match to reference: {}", dao.getAllStops().size(), reference.getAllStops().size(), matches);

ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
String feed = CloudContextService.getLikelyFeedName(dao);

es.publishMetric(CloudContextService.getNamespace(), "ATISBusTripsThisWeek", "feed",feed, atisTripsThisWeek);
es.publishMetric(CloudContextService.getNamespace(), "refBusTripsThisWeek", "feed",feed, refTripsThisWeek);
es.publishMetric(CloudContextService.getNamespace(), "matchingBusTripsThisWeek", "feed",feed, matchingTripsThisWeek);
es.publishMetric(CloudContextService.getNamespace(), "SdonBusTripsThisWeek","feed",feed, refTripsThisWeekWithSdon);
es.publishMetric(CloudContextService.getNamespace(), "A9BusTripsThisWeek", "feed",feed, refTripsThisWeekWoutSdonWithA9);
es.publishMetric(CloudContextService.getNamespace(), "B9BusTripsThisWeek", "feed",feed, refTripsThisWeekWoutSdonWithB9);
es.publishMetric(CloudContextService.getNamespace(), "D9BusTripsThisWeek", "feed",feed, refTripsThisWeekWoutSdonWithD9);
es.publishMetric(CloudContextService.getNamespace(), "E9BusTripsThisWeek", "feed",feed, refTripsThisWeekWoutSdonWithE9);
es.publishMetric(CloudContextService.getNamespace(), "H9BusTripsWitThisWeek", "feed",feed, refTripsThisWeekWoutSdonWithH9);
es.publishMetric(CloudContextService.getNamespace(), "OtherTripsWithoutMatchThisWeek", "feed",feed, leftOverNoMatchThisWeek);

if (curSerTrips < 1) {
throw new IllegalStateException(
"There is no current service!!");
}
es.publishMetric(CloudContextService.getNamespace(),"BusTripsInServiceToday","feed", feed,curSerTrips);

if (countNoHs > 0) {
_log.error("There are trips with no headsign");
}
es.publishMetric(CloudContextService.getNamespace(), "TripsWithoutHeadsigns", "feed", feed, countNoHs);

HashSet<String> ids = new HashSet<String>();
for (Stop stop : dao.getAllStops()) {
//check for duplicate stop ids.
if (ids.contains(stop.getId().getId())) {
if (ids.contains(stop.getId().getId())) {
_log.error("Duplicate stop ids! Agency {} stop id {}", agency, stop.getId().getId());
es.publishMultiDimensionalMetric(CloudContextService.getLikelyFeedName(dao),"DuplicateStopIds", new String[]{"feed","stopId"}, new String[] {feed,stop.getId().toString()},1);
}
}
else {
ids.add(stop.getId().getId());
}
if (!ids.contains(stop.getId().getId())) {
ids.add(stop.getId().getId());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.model.calendar.ServiceDate;
import org.onebusaway.gtfs.services.GtfsMutableRelationalDao;
Expand Down Expand Up @@ -129,24 +127,16 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
}
_log.info("ATIS Stops: {}, Reference: {}, ATIS match to reference: {}", dao.getAllStops().size(), reference.getAllStops().size(), matches);

ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
String feed = CloudContextService.getLikelyFeedName(dao);

es.publishMetric(CloudContextService.getNamespace(),"SubwayTripsInServiceToday","feed", feed,curSerTrips);

if (countNoHs > 0) {
_log.error("There are trips with no headsign");
}
es.publishMetric(CloudContextService.getNamespace(), "TripsWithoutHeadsigns", "feed", feed, countNoHs);

HashSet<String> ids = new HashSet<String>();
for (Stop stop : dao.getAllStops()) {
//check for duplicate stop ids.
if (ids.contains(stop.getId().getId())) {
_log.error("Duplicate stop ids! Agency {} stop id {}", agency, stop.getId().getId());
es.publishMultiDimensionalMetric(CloudContextService.getNamespace(),"DuplicateStopIds", new String[]{"feed","stopId"}, new String[] {feed,stop.getId().toString()},1);
throw new IllegalStateException(
"There are duplicate stop ids!");
}
else {
ids.add(stop.getId().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.gtfs.model.*;
import org.onebusaway.gtfs.serialization.mappings.StopTimeFieldMappingFactory;
import org.onebusaway.gtfs.services.GtfsMutableRelationalDao;
Expand Down Expand Up @@ -63,14 +61,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {

File controlFile = new File((String) context.getParameter("controlFile"));
String feed = CloudContextService.getLikelyFeedName(dao);
ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
if(!controlFile.exists()) {
es.publishMultiDimensionalMetric(CloudContextService.getNamespace(),"MissingControlFiles",
new String[]{"feed","controlFileName"},
new String[]{feed,controlFile.getName()},1);
throw new IllegalStateException(
"Control file does not exist: " + controlFile.getName());
}

AgencyAndId agencyAndId = dao.getAllTrips().iterator().next().getId();
List<String> controlLines = new InputLibrary().readList((String) context.getParameter("controlFile"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.csv_entities.schema.annotations.CsvField;
import org.onebusaway.gtfs.model.AgencyAndId;
import org.onebusaway.gtfs.model.FeedInfo;
Expand Down Expand Up @@ -142,29 +140,12 @@ public String getName() {
@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao) {

ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
Collection<FeedInfo> feedInfos = dao.getAllFeedInfos();
String feed = null;
if(feedInfos.size() > 0)
feed = feedInfos.iterator().next().getPublisherName();
File entrancesFile = new File(entrancesCsv);
if(!entrancesFile.exists()) {
es.publishMultiDimensionalMetric(getNamespace(),"MissingControlFiles",
new String[]{"feed","controlFileName"},
new String[]{feed,entrancesCsv},1);
throw new IllegalStateException(
"Entrances file does not exist: " + entrancesFile.getName());
}

if (elevatorsCsv != null) {
File elevatorsFile = new File(elevatorsCsv);
if(!elevatorsFile.exists()) {
es.publishMultiDimensionalMetric(getNamespace(),"MissingControlFiles",
new String[]{"feed","controlFileName"},
new String[]{feed,elevatorsCsv},1);
throw new IllegalStateException(
"Elevators file does not exist: " + elevatorsFile.getName());
}
}

_log.info("elevatorCsv={}, entrancesCsv={}, accessibleComplexFile={}", elevatorsCsv, entrancesCsv, accessibleComplexFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.onebusaway.gtfs_transformer.impl;

import org.onebusaway.cloud.api.ExternalServices;
import org.onebusaway.cloud.api.ExternalServicesBridgeFactory;
import org.onebusaway.csv_entities.schema.annotations.CsvField;
import org.onebusaway.gtfs.model.FeedInfo;
import org.onebusaway.gtfs.model.Stop;
Expand Down Expand Up @@ -55,7 +53,6 @@ public String getName() {
@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao) {

ExternalServices es = new ExternalServicesBridgeFactory().getExternalServices();
Collection<FeedInfo> feedInfos = dao.getAllFeedInfos();

// name the feed for logging/reference
Expand All @@ -69,13 +66,6 @@ public void run(TransformContext context, GtfsMutableRelationalDao dao) {
}

File stationsFile = new File(stationsCsv);
if (!stationsFile.exists()) {
es.publishMultiDimensionalMetric(getNamespace(), "MissingControlFiles",
new String[]{"feed", "controlFileName"},
new String[]{feed, stationsCsv}, 1);
throw new IllegalStateException(
"Entrances file does not exist: " + stationsFile.getName());
}

// see MTAStationAccessibilityStrategyTest for discussion of how this works
List<MTAStation> stations = getStations();
Expand Down
Loading

0 comments on commit ca6fc03

Please sign in to comment.