Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local oai changes #65

Merged
merged 7 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions models/nr-documents/harvest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
properties:
oai:
properties:
harvest:
properties:
identifier:
type: keyword
label.cs: OAI identifikátor
label.en: OAI identifier
datestamp:
type: keyword
label.cs: Datum poslední změny
label.en: Datestamp
service-config:
components:
- "{{invenio_records_resources.services.records.components.DataComponent}}"
1 change: 1 addition & 0 deletions models/nr-documents/model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ record:
- invenio
- ./custom_fields.yaml
- ./requests.yaml
- ./harvest.yaml
plugins:
builder:
disable:
Expand Down
40 changes: 40 additions & 0 deletions models/nr-documents/nr_documents/models/records.json
Original file line number Diff line number Diff line change
Expand Up @@ -5730,6 +5730,46 @@
}
}
},
"oai": {
"type": "object",
"marshmallow": {
"generate": true,
"class": "nr_documents.services.records.schema.OaiSchema"
},
"ui": {
"marshmallow": {
"generate": true,
"class": "nr_documents.services.records.ui_schema.OaiUISchema"
}
},
"properties": {
"harvest": {
"type": "object",
"marshmallow": {
"generate": true,
"class": "nr_documents.services.records.schema.HarvestSchema"
},
"ui": {
"marshmallow": {
"generate": true,
"class": "nr_documents.services.records.ui_schema.HarvestUISchema"
}
},
"properties": {
"datestamp": {
"type": "keyword",
"label.cs": "Datum poslední změny",
"label.en": "Datestamp"
},
"identifier": {
"type": "keyword",
"label.cs": "OAI identifikátor",
"label.en": "OAI identifier"
}
}
}
}
},
"syntheticFields": {
"type": "object",
"marshmallow": {
Expand Down
34 changes: 34 additions & 0 deletions models/nr-documents/nr_documents/models/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,40 @@
}
}
},
"oai": {
"detail": false,
"input": false,
"help": "oai.help",
"label": "oai.label",
"hint": "oai.hint",
"children": {
"harvest": {
"detail": false,
"input": false,
"help": "oai/harvest.help",
"label": "oai/harvest.label",
"hint": "oai/harvest.hint",
"children": {
"datestamp": {
"detail": "keyword",
"input": "keyword",
"help": "oai/harvest/datestamp.help",
"label": "oai/harvest/datestamp.label",
"hint": "oai/harvest/datestamp.hint",
"facet": "oai_harvest_datestamp"
},
"identifier": {
"detail": "keyword",
"input": "keyword",
"help": "oai/harvest/identifier.help",
"label": "oai/harvest/identifier.label",
"hint": "oai/harvest/identifier.hint",
"facet": "oai_harvest_identifier"
}
}
}
}
},
"syntheticFields": {
"detail": "syntheticfield",
"input": "syntheticfield",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,22 @@
}
}
},
"oai": {
"type": "object",
"properties": {
"harvest": {
"type": "object",
"properties": {
"datestamp": {
"type": "string"
},
"identifier": {
"type": "string"
}
}
}
}
},
"syntheticFields": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,24 @@
}
}
},
"oai": {
"type": "object",
"properties": {
"harvest": {
"type": "object",
"properties": {
"datestamp": {
"type": "keyword",
"ignore_above": 1024
},
"identifier": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
},
"syntheticFields": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,24 @@
}
}
},
"oai": {
"type": "object",
"properties": {
"harvest": {
"type": "object",
"properties": {
"datestamp": {
"type": "keyword",
"ignore_above": 1024
},
"identifier": {
"type": "keyword",
"ignore_above": 1024
}
}
}
}
},
"syntheticFields": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ class DeleteRecordRequestType(DeleteRecordRequestType):
# {"record": {pid}} as reference value. This reference is then by
# setattr set on the Request record topic ReferencedEntityField, and the set
# operation checks, whether this key is in allowed_topic_ref_types
# TODO would it make sense to customize the topic ref types?
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ class PublishDraftRequestType(PublishDraftRequestType):
# {"record": {pid}} as reference value. This reference is then by
# setattr set on the Request record topic ReferencedEntityField, and the set
# operation checks, whether this key is in allowed_topic_ref_types
# TODO would it make sense to customize the topic ref types?
8 changes: 8 additions & 0 deletions models/nr-documents/nr_documents/services/records/facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,14 @@
field="metadata.version", label=_("metadata/version.label")
)

oai_harvest_datestamp = TermsFacet(
field="oai.harvest.datestamp", label=_("oai/harvest/datestamp.label")
)

oai_harvest_identifier = TermsFacet(
field="oai.harvest.identifier", label=_("oai/harvest/identifier.label")
)

syntheticFields_institutions = TermsFacet(
field="syntheticFields.institutions", label=_("syntheticFields/institutions.label")
)
Expand Down
24 changes: 21 additions & 3 deletions models/nr-documents/nr_documents/services/records/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ def pop_publish_draft_if_none(self, data, many, **kwargs):
return data


class NrDocumentsSchema(NRDocumentRecordSchema):
class Meta:
unknown = ma.RAISE

oai = ma_fields.Nested(lambda: OaiSchema())

syntheticFields = ma_fields.Nested(lambda: SyntheticFieldsSchema())
parent = ma.fields.Nested(GeneratedParentSchema)


class GeoLocationsItemSchema(NRGeoLocationSchema):
class Meta:
unknown = ma.RAISE
Expand All @@ -128,12 +138,11 @@ class Meta:
thesis = ma_fields.Nested(lambda: ThesisSchema())


class NrDocumentsSchema(NRDocumentRecordSchema):
class OaiSchema(Schema):
class Meta:
unknown = ma.RAISE

syntheticFields = ma_fields.Nested(lambda: SyntheticFieldsSchema())
parent = ma.fields.Nested(GeneratedParentSchema)
harvest = ma_fields.Nested(lambda: HarvestSchema())


class RelatedItemsItemSchema(NRRelatedItemSchema):
Expand Down Expand Up @@ -251,6 +260,15 @@ class Meta:
unknown = ma.RAISE


class HarvestSchema(Schema):
class Meta:
unknown = ma.RAISE

datestamp = ma_fields.String()

identifier = ma_fields.String()


class ItemContributorsItemSchema(NRRelatedItemContributorSchema):
class Meta:
unknown = ma.RAISE
Expand Down
2 changes: 2 additions & 0 deletions models/nr-documents/nr_documents/services/records/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class NrDocumentsSearchOptions(I18nSearchOptions):
"metadata_thesis_studyFields": facets.metadata_thesis_studyFields,
"metadata_title": facets.metadata_title,
"metadata_version": facets.metadata_version,
"oai_harvest_datestamp": facets.oai_harvest_datestamp,
"oai_harvest_identifier": facets.oai_harvest_identifier,
"syntheticFields_institutions": facets.syntheticFields_institutions,
"syntheticFields_keywords_cs": facets.syntheticFields_keywords_cs,
"syntheticFields_keywords_en": facets.syntheticFields_keywords_en,
Expand Down
24 changes: 21 additions & 3 deletions models/nr-documents/nr_documents/services/records/ui_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ def pop_publish_draft_if_none(self, data, many, **kwargs):
return data


class NrDocumentsUISchema(NRDocumentRecordUISchema):
class Meta:
unknown = ma.RAISE

oai = ma_fields.Nested(lambda: OaiUISchema())

syntheticFields = ma_fields.Nested(lambda: SyntheticFieldsUISchema())
parent = ma.fields.Nested(GeneratedParentSchema)


class GeoLocationsItemUISchema(NRGeoLocationUISchema):
class Meta:
unknown = ma.RAISE
Expand All @@ -130,12 +140,11 @@ class Meta:
thesis = ma_fields.Nested(lambda: ThesisUISchema())


class NrDocumentsUISchema(NRDocumentRecordUISchema):
class OaiUISchema(Schema):
class Meta:
unknown = ma.RAISE

syntheticFields = ma_fields.Nested(lambda: SyntheticFieldsUISchema())
parent = ma.fields.Nested(GeneratedParentSchema)
harvest = ma_fields.Nested(lambda: HarvestUISchema())


class RelatedItemsItemUISchema(NRRelatedItemUISchema):
Expand Down Expand Up @@ -253,6 +262,15 @@ class Meta:
unknown = ma.RAISE


class HarvestUISchema(Schema):
class Meta:
unknown = ma.RAISE

datestamp = ma_fields.String()

identifier = ma_fields.String()


class ItemContributorsItemUISchema(NRRelatedItemContributorUISchema):
class Meta:
unknown = ma.RAISE
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"POT-Creation-Date: 2023-11-02T09:17:40.420744\n"
"PO-Revision-Date: 2023-11-02T09:17:40.420755\n"
"POT-Creation-Date: 2023-11-13T08:42:04.454823\n"
"PO-Revision-Date: 2023-11-13T08:42:04.454834\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -1869,6 +1869,42 @@ msgstr ""
msgid "metadata/version.hint"
msgstr ""

msgid "oai.help"
msgstr ""

msgid "oai.label"
msgstr ""

msgid "oai.hint"
msgstr ""

msgid "oai/harvest.help"
msgstr ""

msgid "oai/harvest.label"
msgstr ""

msgid "oai/harvest.hint"
msgstr ""

msgid "oai/harvest/datestamp.label"
msgstr "Datum poslední změny"

msgid "oai/harvest/datestamp.help"
msgstr ""

msgid "oai/harvest/datestamp.hint"
msgstr ""

msgid "oai/harvest/identifier.label"
msgstr "OAI identifikátor"

msgid "oai/harvest/identifier.help"
msgstr ""

msgid "oai/harvest/identifier.hint"
msgstr ""

msgid "syntheticFields.help"
msgstr ""

Expand Down
Binary file not shown.
Loading
Loading