Skip to content

Commit

Permalink
Update catalog metrics
Browse files Browse the repository at this point in the history
Exclude service from dataset metrics.
Compute organization and metadataType metrics from datasets.
  • Loading branch information
tusbar committed Feb 12, 2019
1 parent 2d1f890 commit c4ea547
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/jobs/compute-catalog-metrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ async function computeCatalogMetrics({data: {catalogId, force = false}}) {

const [datasets, records, mostRecentRecord] = await Promise.all([
search({
type: 'dataset',
catalog: catalog.name,
limit: 1
}, {
excludeServices: true
}),

search({
Expand All @@ -81,19 +82,19 @@ async function computeCatalogMetrics({data: {catalogId, force = false}}) {
const metrics = {
records: {
totalCount: records.hits.total,
counts: {
organizations: countBy(records, 'organizations')
},
counts: {},
partitions: {
recordType: countBy(records, 'type'),
metadataType: countBy(datasets, 'metadataType')
recordType: countBy(records, 'type')
}
},
datasets: {
totalCount: datasets.hits.total,
counts: {},
counts: {
organizations: countBy(datasets, 'organizations')
},
partitions: {
dataType: countBy(datasets, 'representationType'),
metadataType: countBy(datasets, 'metadataType'),
openness: countBy(datasets, 'opendata'),
download: countBy(datasets, 'downloadable')
}
Expand Down

0 comments on commit c4ea547

Please sign in to comment.