# oarepo\_oaipmh\_harvester.oai\_record.models

## `oarepo_oaipmh_harvester.oai_record.models`

Models for OAI-PMH harvested records.

### `OAIHarvestedRecord`

Bases: `Model`

Metadata about a harvested record.

Always contains the latest metadata of the record, no previous versions are stored.

#### `oai_identifier = db.Column(db.String(255), primary_key=True)`

OAI identifier of the record.

#### `record_type = db.Column(db.String(32), nullable=True)`

Type of the record.

#### `record_pid = db.Column(db.String(255), nullable=True)`

Persistent identifier (Record.pid) of the record (local identifier).

Note that this is not the database ID but the PID value.

#### `datestamp = db.Column(db.UTCDateTime, nullable=False)`

Datestamp of the record.

#### `harvested_at = db.Column(db.UTCDateTime, nullable=False)`

Time when the record was harvested.

#### `deleted = db.Column(db.Boolean, default=False, nullable=False)`

True if the record was deleted during the harvest.

#### `has_errors = db.Column(db.Boolean, default=False, nullable=False)`

True if the record has errors during the harvest.

#### `has_warnings = db.Column(db.Boolean, default=False, nullable=False)`

True if the record has warnings during the harvest.

#### `errors = db.Column(db.JSON().with_variant(postgresql.JSONB(none_as_null=True), 'postgresql').with_variant(JSONType(), 'sqlite').with_variant(JSONType(), 'mysql'), default=dict, nullable=False)`

Errors.

#### `original_data = db.Column(db.JSON().with_variant(postgresql.JSONB(none_as_null=True), 'postgresql').with_variant(JSONType(), 'sqlite').with_variant(JSONType(), 'mysql'), default=dict, nullable=False)`

Original data.

#### `transformed_data = db.Column(db.JSON().with_variant(postgresql.JSONB(none_as_null=True), 'postgresql').with_variant(JSONType(), 'sqlite').with_variant(JSONType(), 'mysql'), default=dict, nullable=False)`

Transformed data before they were stored into the target record.

#### `harvester_id = db.Column(db.String(30), db.ForeignKey('oai_harvesters.id'), nullable=False)`

ID of the harvester that harvested this record.

#### `job_run_id = db.Column(UUIDType(binary=False), nullable=True)`

Run ID of the harvest run (from invenio-jobs).

### `OAIRecordAggregateModel`

Bases: `AggregateMetadata`

Aggregate data model for harvested OAI-PMH records.

#### `model_obj: OAIHarvestedRecord`

The actual model object behind this record aggregate.

#### `version_id: int`

Return the version ID of the record.

#### `created: dt.datetime`

Return the creation date of the record.

#### `updated: dt.datetime`

Return the last update date of the record.

#### `id: str`

Return the ID of the record.
