======================================== Author-Time Aggregation Sample ======================================== This is a StreamBase Studio project for LiveView that configures a Server instance with the following: - An OlympicData table that reflects a live view of Olympic records being digitized for the International Olympic Committee (IOC). These records contain which Olympics they are from, the country and athlete, event and time, and whether the athlete was tested positives for drugs. The "countries" are represented by the moons of Saturn for this sample. Additional tables used in this sample are described at the end of this document. To run this sample in Studio, you can: - In the LiveView Project Viewer, click the green Run button in the upper right. - Right-click any of the lvconf table configuration files in the Project Explorer view and select Run As > Run Configurations > Run (in the invoked Run Configurations dialog). - Right-click the project folder itself, and select Run As > LiveView Fragment Without control, the OlympicData table would grow without bound, because the generated data for the primary key of the table is overwhelmingly unique. To counteract this, there is an alert configured that fires when a PublishedAt is older then some time expression, which by default resolves to five minutes. The alert has two actions configured, one that publishes a row to the LVAlerts table indicating that a delete has occurred and the other is a delete action. The delete action is configured such that all OlympicData rows with a publishedAt older then some time expression - four minutes by default - are deleted. This means that the OlympicData table always has at least the last four minutes of data, and at most the last five minutes of data. To run this sample from the command line outside of Studio, you must: - Package this sample's LiveView fragment project into a fragment archive. - Create a separate StreamBase Application project, and set the pom.xml for that project to depend on the fragment archive created in the previous step. - Create a separate StreamBase Application archive file. - Install that archive into a StreamBase Runtime node. - Start the node. These steps are described in more detail in the "Deploy with epadmin" page of the Concepts Overview in the StreamBase documentation. Additional files present in the project: DataSource.lvconf - registers the OlympicDataSource/application.sbapp file with LiveView. This application starts automatically after all LiveView tables have loaded on startup. OlympicData.sbfs - a feed simulation that sends a data to the OlympicData table. engine.conf - a LiveView configuration file to set up JVM arguments for this sample. lv-interfaces/*.sbint These StreamBase interface (.sbint) files are generated by StreamBase Studio from the information provided in the OlympicData.lvconf file by the LiveView Data Source wizard, and are referenced in OlympicDataSource/application.sbapp. - A CountryWinners table, which is an aggregate table on the OlympicData table. This table rolls up OlympicData by Year, Country, and Event to find the best time and associated athlete for each. Athletes that test positive for doping are excluded with a predicate before they are included in the statistics. - A RecentCountryWinner table, which is an aggregate table on the OlympicData table. This table is identical to the CountryWinners with the exception of that it only considers the most recent 10 seconds of data. This is accomplished via a predicate with a time window. - A DopingSummary table, which is an aggregate table on the OlympicData table. This table computes the percentage of year-country-event teams that are doping. Notice the simulation data has athletes from Saturn's moon Rhea doping, especially the track team. - A DopingByCountry table, which is a derived aggregate table on the DopingSummary table. This table computes the total number of athletes in a given country who are doping. While we could have had this table's base table be OlympicData, it is more performant to cascade and derive an aggregate from another aggregate table, rather than derive two aggregates from one non-aggregate table. - An EventRecords table, which is an aggregate table on the OlympicData table. This table computes, for each event, the best athlete and nationality, along with the average time and the percent of athletes testing positive for doping. - A MedalCount table, which is a derived aggregate table on the EventRecords table. This table computes, for each event, which country won. - A Medals2012 table, which is a derived aggregate table on the MedalCount table. This table computes, for each country, how many Olympic records they have. - A MedalsTotal table, which is a derived aggregate table on the MedalCount table. This table shows which events a given country in a given year has earned. - A PivotYearlyTime table, which shows each country and event's average time and maximum time pivoted by year(2008,2012,2016). - An EventFlow application (OlympicDataSource/application.sbapp) that is responsible for sending data into the OlympicData table. This application has a Feed Simulation Input Adapter executing the feed simulation named OlympicData.sbfs. More information is available in the LiveView documentation.