Skip to content

Commit

Permalink
obtain unique doi count
Browse files Browse the repository at this point in the history
investigate the percentage of of missing Crossref DOI metadata in crossref.citations needed for: datacite/datacite#785

with these two counters we can investigate how many *unique* Crossref DOI  we have in Eventdata, in order to calculate the percentage of metadat missin in crossref.citations
  • Loading branch information
kjgarza committed Aug 23, 2019
1 parent 731e414 commit 6a00bbd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def index
downloads_histogram = total.positive? && aggregations.include?("metrics_aggregations") ? facet_counts_by_year_month(response.response.aggregations.downloads_histogram) : nil
views = total.positive? && aggregations.include?("metrics_aggregations") ? facet_by_source(response.response.aggregations.views.dois.buckets) : nil
downloads = total.positive? && aggregations.include?("metrics_aggregations") ? facet_by_source(response.response.aggregations.downloads.dois.buckets) : nil
unique_obj_count = total.positive? && aggregations.include?("advanced_aggregations") ? response.response.aggregations.unique_obj_count.value : nil
unique_subj_count = total.positive? && aggregations.include?("advanced_aggregations") ? response.response.aggregations.unique_subj_count.value : nil

results = response.results

Expand All @@ -151,6 +153,10 @@ def index
"doisCitations": dois_citations,
"citationsHistogram": citations_histogram,
"uniqueCitations": citations,
"uniqueNodes": {
"objCount": unique_obj_count,
"subjCount": unique_subj_count
},
"viewsHistogram": views_histogram,
"views": views,
"downloadsHistogram": downloads_histogram,
Expand Down
7 changes: 7 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ def self.metrics_aggregations
}
end

def self.advanced_aggregations
{
unique_obj_count: { cardinality: { field: 'obj_id' }},
unique_subj_count: { cardinality: { field: 'subj_id' }}
}
end

# return results for one or more ids
def self.find_by_id(ids, options={})
ids = ids.split(",") if ids.is_a?(String)
Expand Down

0 comments on commit 6a00bbd

Please sign in to comment.