Class GeoSourceMetadataBuilder

java.lang.Object
ubic.gemma.core.loader.expression.geo.GeoSourceMetadataBuilder

public class GeoSourceMetadataBuilder extends Object
Builds the schema-v1 Investigation.sourceMetadata document from a parsed GeoSeries.

This is a verbatim cache of what GEO said, not curation: it is rebuildable from the source at any time and carries no judgement of ours. Its purpose is to give the curation agent the raw per-sample view — submitter-written characteristic columns and per-sample titles as they were written — so it can tell "the submitter copy-pasted this column into every row" from "this column is a real experimental factor". Gemma's own converter flattens that view into BioMaterial.characteristics and cannot answer the question.

The document is built from objects already parsed at import; nothing is re-fetched. Several fields it carries are ones the converter discards outright (dataProcessing, hybProtocol, scanProtocol, supplementaryFiles, submission dates).

Contract. Schema v1 was agreed with CAB on 2026-08-09 (GEMMA_REPLY_2026_08_09_SOURCE_METADATA_BLOB.md). Rules that are not obvious from the shape:

  • Keys are camelCase; the consumer normalizes once at ingestion.
  • Absent means absent. A field GEO did not state is omitted, never written as null or "".
  • characteristics is always an object, never an array, even when empty.
  • Channel fields beyond the first are prefixed ch{N}_.
  • pmids / dois, not pubMedIdsto_snake("pubMedIds") yields pub_med_ids, which nothing on the consuming side reads, so the field would silently arrive empty.
  • samples is a list with accession on each element, not a GSM-keyed map.
  • v1 is not one shape. sampleType was added on 2026-08-29 without bumping the version (Paul's call), so a document stamped schemaVersion: 1 may or may not carry it and a consumer cannot tell which by the version. Every field is optional by the absent-means-absent rule above, so this changes nothing for a reader that honours it; it does mean the version is not a way to detect the field.
Author:
Gemma
  • Field Details

    • SCHEMA_VERSION

      public static final int SCHEMA_VERSION
      Schema version written into the document and into Investigation.sourceMetadataSchemaVersion. A null version in the database marks the older, smaller scrape-path payload written by GeoScrapeServiceImpl.
      See Also:
  • Constructor Details

    • GeoSourceMetadataBuilder

      public GeoSourceMetadataBuilder(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • build

      @Nullable public String build(@Nullable GeoSeries series, GeoSourceMetadataBuilder.ExperimentIdentity identity, Date harvestedAt)
      Build the document. Returns null when there is nothing worth storing, so the caller can leave both columns null rather than storing an empty shell.
      Parameters:
      series - the parsed series; its samples supply the per-sample view
      identity - experiment identity, resolved after persist (see GeoSourceMetadataBuilder.ExperimentIdentity)
      harvestedAt - when Gemma built this document — our clock, not GEO's. GEO's own dates are carried separately as submissionDate / lastUpdateDate.