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

Serialize new custom fields #1231

Closed
8 tasks
anikachurilova opened this issue Mar 7, 2023 · 4 comments · Fixed by inveniosoftware/flask-resources#116 or #1258
Closed
8 tasks

Serialize new custom fields #1231

anikachurilova opened this issue Mar 7, 2023 · 4 comments · Fixed by inveniosoftware/flask-resources#116 or #1258

Comments

@anikachurilova
Copy link
Member

anikachurilova commented Mar 7, 2023

Support new custom fields: journal, thesis, notes, meeting, imprint in existing serializers:

  • csl
  • datacite
  • dcat
  • dublincore
  • geojson
  • iiif
  • marcxml
  • bibtex
@anikachurilova anikachurilova added the bug Something isn't working label Mar 7, 2023
@anikachurilova anikachurilova changed the title Serialise new custom fields Serialize new custom fields Mar 7, 2023
@anikachurilova anikachurilova removed the bug Something isn't working label Mar 7, 2023
@alejandromumo
Copy link
Member

alejandromumo commented Mar 10, 2023

We have two options in the RFC:

  • Per field:
class RandomFieldExporter:

    def marc_xml():
        ...

    def datacitev43():
        ...


RDM_CUSTOM_FIELDS = {
    "experiment": VocabularyCF(
        ...
        export=RandomFieldExporter()
    ),
}
  • Per export format
class MARCXmlExporter:

    def experiments():
        ...

class DublinCoreExporter:

    def experiments():
        ...


RDM_CUSTOM_FIELDS = {
    "experiment": VocabularyCF(
        ...
        export=dict(
            marc=MARCXmlExporter(),
            dublin_core=DublinCoreExporter()
        )
    ),
}

This topic needs a discussion before the implementation

@alejandromumo
Copy link
Member

We decided to prototype the option per field, using journal as an example.

The prototype should also contain multiple formats to have a grasp on how this can grow in terms of code

@alejandromumo
Copy link
Member

For the prototype, we decided to add a generic post dump pipeline (can also be implemented for other stages of the serialization, e.g. pre_dump).

Each serializer then adds the steps it sees fit for its own needs (e.g. DataciteJsonSerializer adds custom fields processors, each defining its own post_dump implementation). Everything is then "merged" together (with many caveats)

@alejandromumo
Copy link
Member

To showcase the implemented mechanism I implemented journal serialization into DataCite, MarcXML and DublinCore. Also added DublinCore serializartion for meeting.

Since this will scale up (e.g. X formats * Y custom fields), I will first wait until the post_dump/pre_dump mechanism is fully approved before implementing all the combinations of custom fields and formats.

Thus, I am moving the issue to review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants