Record Class Provenance

java.lang.Object
java.lang.Record
ai.doctruth.Provenance
Record Components:
model - logical model identifier, e.g. "claude-sonnet-4-7".
modelVersion - provider-reported model version, e.g. a date stamp or build id.
extractedAt - UTC timestamp at which the extraction call completed.
sourcePublishedAt - UTC timestamp at which the source document was published, if known.
details - retry / residency / retention metadata.

public record Provenance(String model, String modelVersion, Instant extractedAt, Optional<Instant> sourcePublishedAt, ProvenanceDetails details) extends Record
Bi-temporal provenance for an ExtractionResult: the model that produced it, when the extraction ran, and (optionally) when the source document was authored, the region the extraction was processed in, and the retention horizon of the audit record.

The bi-temporal pair (extractedAt, sourcePublishedAt) is the differentiator vs. typical Java extraction pipelines: downstream auditors can answer "did we extract this value before or after the source was updated?" without storing extra metadata on every record.

The two compliance fields region and retainUntil close the AU-bank-tier audit gap: when a regulator asks "where was this processed?" or "how long are you keeping the audit record?", these fields give a verifiable answer per record.

Invariants (enforced by the compact constructor):

  • model, modelVersion are non-null and non-blank.
  • extractedAt is non-null.
  • sourcePublishedAt is a non-null Optional. Pass Optional.empty(), not null, when absent.
  • details is non-null and carries retry / residency / retention metadata.
Since:
0.1.0
  • Constructor Details

  • Method Details

    • region

      public Optional<String> region()
    • retainUntil

      public Optional<Instant> retainUntil()
    • retries

      public int retries()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • model

      public String model()
      Returns the value of the model record component.
      Returns:
      the value of the model record component
    • modelVersion

      public String modelVersion()
      Returns the value of the modelVersion record component.
      Returns:
      the value of the modelVersion record component
    • extractedAt

      public Instant extractedAt()
      Returns the value of the extractedAt record component.
      Returns:
      the value of the extractedAt record component
    • sourcePublishedAt

      public Optional<Instant> sourcePublishedAt()
      Returns the value of the sourcePublishedAt record component.
      Returns:
      the value of the sourcePublishedAt record component
    • details

      public ProvenanceDetails details()
      Returns the value of the details record component.
      Returns:
      the value of the details record component