Skip to content

As a data engineer, I want Harvest to index XML attributes from PDS4 label elements #92

Description

@jordanpadams

Summary

As a data engineer loading PDS4 labels into the registry, I want Harvest to correctly extract and index XML attributes from PDS4 elements (e.g., xsi:nil="true", nilReason, unit, and other PDS4-defined attributes), so that the registry faithfully captures all metadata encoded in XML attributes rather than silently dropping them.

Motivation

The current AutogenExtractor walks the XML DOM and for each leaf element calls getTextContent() to extract the field value. XML attributes are never read. This means any metadata encoded as an XML attribute — not just element text content — is silently dropped during harvest. Examples include:

  1. xsi:nil="true" and nilReason on nillable elements (e.g., <pds:stop_date_time xsi:nil="true" nilReason="unknown"/>) — indexed as an empty string "", indistinguishable from a genuinely blank value.
  2. unit on measurement elements (e.g., <pds:length unit="km">1200</pds:length>) — the unit is lost.
  3. Any other PDS4 discipline dictionary or mission dictionary attributes on elements.

Downstream consumers (API, search clients) have no way to access or search this information.

This is directly relevant to the PDS4 CCB discussion in NASA-PDS/PDS4-CCB#95 regarding how nil attributes and empty classes should be handled, but the broader issue of XML attribute indexing applies beyond nil alone.

Proposed Solution

When AutogenExtractor (or equivalent XML extraction logic) processes a leaf element:

  1. In addition to extracting element text content, read any XML attributes present on the element.
  2. Index each attribute as a companion field, e.g., <fieldName>/<attrName> or <fieldName>__<attrName> (naming convention TBD during design).
  3. For xsi:nil="true", also store a clear sentinel or boolean so consumers can distinguish nil-by-declaration from empty/absent.

The exact field naming convention and OpenSearch representation should be determined during implementation in coordination with the registry-api team to ensure consistent searchability.

Additional Context

🦄 Related requirements

NASA-PDS/registry-api#789


For Internal Dev Team To Complete

⚙️ Engineering Details

To be completed by engineering team

🎉 Integration & Test

To be completed by engineering team

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions