Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yuenmichelle1 authored Oct 24, 2024
1 parent 8bce3cc commit b6b2b46
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
[![pullreminders](https://pullreminders.com/badge.svg)](https://pullreminders.com?ref=badge)

# zoo-event-stats
Event stream reader and JSON stats API for Zooniverse wide and project classification and comment counts.
# zoo-event-stats (DEPRECATED STATS SERVICE. ONLY USED TO PUSH DATA TO PUSHER PUBLIC DATA STREAM)

DEPRECATED STATS SERVICE. Replaced with ERAS: https://github.com/zooniverse/eras. This service is only used to push data to Pusher public data stream.

#### Stream Reader

This service contains a Kinesis stream reader for the internal Zooniverse data stream.
Each record on the input stream is processed if it's a talk comment or classification event.
Processing invovles tranforming the incoming data and
pushing data into both the Elastic Search data store and to the Pusher public data stream (public data only).
Processing involves tranforming the incoming data and
pushing data into the Pusher public data stream (public data only).

See [KCLReader](./lib/input/kcl_reader.rb) and [start_stream](./bin/start_stream) for more details.

#### API
The stats service has a json API to query the event counts for projects

##### `GET /counts/$event_type/$period?user_id=1&project_id=1`
Get the counts of events that match the event type over the period.

Valid `$event_type` values are `classification` and `comment`.

Valid `$period` values are `minute`, `hour`, `day`, `week`, `month`, `quarter`, `year`.
More details at [Value ES period values](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-datehistogram-aggregation.html#_calendar_intervals)

Valid `?user_id` values are integers, e.g. `1`

Valid `?project_id` values are integers or a comma seperated list, e.g. `1` or `1,2,3`

This end points returns json data in the format below where the each period will return an object in the buckets list.
```
{
"events_over_time": {
"buckets": [
{
"key_as_string": "2016-06-13T00:00:00.000Z",
"key":1465776000000,
"doc_count":25
}
]
}
}
```

#### Getting Started

Expand All @@ -62,8 +34,6 @@ Once all the above steps complete you will have a working copy of the checked ou
* Run: `docker-compose run --rm --service-ports api /bin/bash`
* Then in the container run: `bundle exec rake test`

0. Seed some data into elastic search
* Then in the container run: `bundle exec rake seed_es_dev_data`

Note: To update Gems from the api container you'll need to run `bundle install --with stream`. This is due to the way the stream & api docker images differ with how their gems are installed via groups. See `bundle config` in the container for details of what groups are installed.

Expand Down

0 comments on commit b6b2b46

Please sign in to comment.