NAME

Astro::ADS::Metrics - Queries the ADS Metrics endpoint and collects the results

VERSION

version 1.91

SYNOPSIS

my $metrics = Astro::ADS::Metrics->new({
    bibcodes  => ['...'],  # list of bibcodes
    { types => ['basic'] } # types of metrics to return
});

my $json_result = $metrics->batch();

my $single_bibcode = $metrics->fetch('2019MNRAS.487.3523C');

my $detailed_stats = $metrics->details( @bibcodes );

DESCRIPTION

Fetch Metrics for papers in the Harvard ADS

Currently only fetch checks the Metrics object for how to make the calls.

The json structure is documented on the ADS API website. I haven't used the ResultMapper to make it easier to access. You'll have to work that out yourself. Let me know if there's a better way.

Methods

fetch

Fetch a single bibcode. No options taken. Returns the json response as a hash reference.

batch

Takes an array ref of bibcodes to find metrics for. An optional hash ref can limit the types of metrics returned and if the type is histogram, which histograms to return. As in

{ types    => ['histograms'], histograms => ['citations'] }

Returns the json response as a hash reference.

details

Queries the metrics/details endpoint with a list of bibcodes. Takes no options. Returns the json response as a hash reference.

Notes

This module's client methods are liable to change, but deprecation warnings will be issued if they do. See the docs.

TODO

The Metrics object should store the arguments from the latest request, so that repeated calls can be brief.

Consider using the ResultMapper to contain results (if that makes sense) or maybe to warn if there are any skipped bibcodes in the response.

See Also

COPYRIGHT AND LICENSE

This software is Copyright (c) 2025 by Boyd Duffee.

This is free software, licensed under:

The MIT (X11) License