Skip to content

Commit

Permalink
added created aggregation
Browse files Browse the repository at this point in the history
its difficult to see if events from crossref or event datacie have been created lated and where the gaps happen. the occured aggregation only focuses on when the events dates were generated but no when they were captured. this aggregation is more useful to identify problems with collection.
  • Loading branch information
kjgarza committed Nov 4, 2021
1 parent 8e1f030 commit f1a57be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ def index
if total > 0
facet_by_year(response.aggregations.occurred.buckets)
end
created =
if total > 0
facet_by_year(response.aggregations.created.buckets)
end
prefixes =
if total.positive?
facet_by_key(response.response.aggregations.prefixes.buckets)
Expand Down Expand Up @@ -219,6 +223,7 @@ def index
page[:cursor].nil? && page[:number].present? ? page[:number] : nil,
sources: sources,
occurred: occurred,
createdAt: created,
prefixes: prefixes,
"citationTypes" => citation_types,
"relationTypes" => relation_types,
Expand Down
10 changes: 10 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ def self.query_aggregations
},
aggs: { bucket_truncate: { bucket_sort: { size: 10 } } },
},
created: {
date_histogram: {
field: "created_at",
interval: "year",
format: "year",
order: { _key: "desc" },
min_doc_count: 1,
},
aggs: { bucket_truncate: { bucket_sort: { size: 10 } } },
},
registrants: {
terms: { field: "registrant_id", size: 10, min_doc_count: 1 },
aggs: {
Expand Down

0 comments on commit f1a57be

Please sign in to comment.