Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

There are many different use cases related to harvesting CMR collection and granule level metadata. The CMR has added a few new features to better support the use cases in a way that the following criteria are met:

  1. Large result sets can be retrieved
  2. While iterating through result sets, the results remain consistent
  3. Performance of other queries in the system are unaffected
  4. Changes to inventory are easily discoverable

After introducing the scrolling concept we will walk through 3 categories of use cases related to harvesting:

  1. Populating External Systems
  2. Capturing Inventory Changes
  3. Synchronizing External Systems with the CMR

CMR Search Basics

This document will assume that the reader is familiar with basic usage of the CMR Search API. You can find more information about the CMR Search API here - CMR Client Partner User Guide, and API documentation here - https://cmr.earthdata.nasa.gov/search/site/docs/search/api.html.

Scrolling

Through Results

Before jumping into the use cases, we should first introduce the scrolling feature on the CMR Search API. Many of the use cases will involve iterating through large results sets of data, and the way that is accomplished via the CMR APIs is by using the scroll query parameter.

Those familiar with the CMR API have potentially used the paging parameters page_num and page_size or offset. There are two downsides to paging that make it not suited well for harvesting:

  1. In between search calls data can be ingested or deleted which means that the same result may show up in multiple calls or data can be missed when going through the pages.
  2. Deep paging is inefficient for our Elasticsearch system. Queries for a high offset will take longer and can impact the performance of other queries in the system. As a result the CMR rejects requests for paging beyond the one millionth result for a search.

Scrolling addresses both of these issues and is the recommended way to harvest CMR metadata.

The scroll query parameter can be used on both the collections and granules search endpoints.

scroll - A boolean flag (true/false) that allows all results to be retrieved efficiently. page_size is supported with scroll while page_num and offset are not. If scroll is true then the first call of a scroll session sets the page size; page_size is ignored on subsequent calls.

Scrolling is only supported for parameter queries, but all query parameters are available with the exception of the page_num and offset parameters. The response format for scrolling queries is identical to the response for normal parameter queries with the exception of the addition of the CMR-Scroll-Id header. The CMR-Hits header is useful for determining the number of requests that will be needed to retrieve all the available results.

Scrolling is session based; the first search conducted with the scroll parameter set to true will return a session id in the form of a CMR-Scroll-Id header. This header should be included in subsequent searches until the desired number of results have been retrieved. Sessions time out after 10 minutes of inactivity; each new query before the timeout is reached with a given CMR-Scroll-Id header will reset the timeout to 10 minutes. Queries occurring after a session has timed out will result in an HTTP 404 status code and error message.

When all the results have been returned subsequent calls using the same CMR-Scroll-Id header will return an empty list. 

Populating External Systems

Clients want to get all or some subset of the metadata from the CMR.

Use Cases

As a harvesting client, I want to retrieve all collection metadata.

 

As a harvesting client, I want to retrieve all collection metadata based on a given tag (CWIC, FedEO)

As a harvesting client, I want to retrieve all granule metadata for a given collection

Capturing Inventory Changes

Clients want to make sure they have the most recent data and have removed any data that is no longer valid.

Use Cases

As a harvesting client, I want to retrieve only the collection metadata which was revised after a given date.
As a harvesting client, I want to retrieve only the collection metadata which was newly added to the CMR after a given date.
As a harvesting client, I want to identify the collection metadata which was deleted after a given date.
As a harvesting client, I want to tell which collections have added granules since the last time I harvested.
As a harvesting client, I want to retrieve only the granule metadata which was revised after a given date.
As a harvesting client, I want to retrieve only the granule metadata which was newly added to the CMR after a given date.
As a harvesting client, I want to identify the granule metadata which was deleted after a given date.
As a harvesting client, I want an Atom feed of new and updated granules.

Synchronizing External Systems with the CMR

Data providers have use cases which involve ensuring an external system is synchronized with the CMR.

 

Table of Contents
outlinetrue
stylenone