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

record: add grouping and sorting of vocabulary fields for "custom" #1870

Open
slint opened this issue Sep 20, 2019 · 1 comment
Open

record: add grouping and sorting of vocabulary fields for "custom" #1870

slint opened this issue Sep 20, 2019 · 1 comment
Assignees

Comments

@slint
Copy link
Member

slint commented Sep 20, 2019

Custom keywords should be displayed in groups by their vocabulary (DarwinCore, AudubunCore, etc.), and sorted based on an optional order key in the ZENODO_CUSTOM_METADATA_VOCABULARIES configuration (see below new example). Some implementation details:

  • We're also adding a name key on the same level as the @context key which will be used for displaying the "group" label (see examples below)
  • Currently the custom keywords rendering takes place in the info.html Jinja template. Feel free to extract some of the more heavy logic in helper JInja filters/functions.
  • Use this example record with custom keywords from multiple vocabularies, to test out the result.
  • Example configuration with some order keys in terms
ZENODO_CUSTOM_METADATA_VOCABULARIES = {
    'dwc': {
        '@context': 'http://rs.tdwg.org/dwc/terms/',
        'name': 'Darwin Core',
        'attributes': {
            'basisOfRecord': {'type': 'keyword', 'label': 'Basis of record'},
            'catalogNumber': {'type': 'keyword', 'label': 'Catalog number'},
            'class': {'type': 'keyword', 'label': 'Class', 'order': 3},
            'collectionCode': {'type': 'keyword', 'label': 'Collection code'},
            'country': {'type': 'keyword', 'label': 'Country'},
            'county': {'type': 'keyword', 'label': 'County'},
            'dateIdentified': {'type': 'keyword', 'label': 'Date identified'},
            'decimalLatitude': {'type': 'keyword', 'label': 'Decimal latitude'},
            'decimalLongitude': {'type': 'keyword', 'label': 'Deimcal longitude'},
            'eventDate': {'type': 'keyword', 'label': 'Event date'},
            'family': {'type': 'keyword', 'label': 'Family', 'order': 5},
            'genus': {'type': 'keyword', 'label': 'Genus', 'order': 6},
            'identifiedBy': {'type': 'keyword', 'label': 'Identified by'},
            'individualCount': {'type': 'keyword', 'label': 'Individual count'},
            'institutionCode': {'type': 'keyword', 'label': 'Institution code'},
            'kingdom': {'type': 'keyword', 'label': 'Kingdom', 'order': 1},
            'lifeStage': {'type': 'keyword', 'label': 'Life stage'},
            'locality': {'type': 'keyword', 'label': 'Locality'},
            'materialSampleID': {'type': 'keyword', 'label': 'Material sample ID'},
            'namePublishedInID': {'type': 'keyword', 'label': 'Name published in ID'},
            'namePublishedInYear': {'type': 'keyword', 'label': 'Name published in year'},
            'order': {'type': 'keyword', 'label': 'Order', 'order': 4},
            'otherCatalogNumbers': {'type': 'keyword', 'label': 'Other catalog numbers'},
            'phylum': {'type': 'keyword', 'label': 'Phylum', 'order': 2},
            'preparations': {'type': 'keyword', 'label': 'Preparations'},
            'recordedBy': {'type': 'keyword', 'label': 'Recorded by'},
            'scientificName': {'type': 'keyword', 'label': 'Scientific name'},
            'scientificNameAuthorship': {'type': 'text', 'label': 'Scientific name authorship'},
            'scientificNameID': {'type': 'keyword', 'label': 'Scientific name ID'},
            'sex': {'type': 'keyword', 'label': 'Sex'},
            'specificEpithet': {'type': 'keyword', 'label': 'Species', 'order': 7},
            'stateProvince': {'type': 'keyword', 'label': 'State province'},
            'taxonID': {'type': 'keyword', 'label': 'Taxon ID'},
            'taxonomicStatus': {'type': 'keyword', 'label': 'Taxonomic status'},
            'taxonRank': {'type': 'keyword', 'label': 'Taxon rank'},
            'typeStatus': {'type': 'keyword', 'label': 'Type status'},
            'verbatimElevation': {'type': 'keyword', 'label': 'Verbatim elevation'},
            'verbatimEventDate': {'type': 'keyword', 'label': 'Verbatim event date'},
        }
    },
    'gbif-dwc': {
        '@context': 'http://rs.gbif.org/terms/1.0/',
        'name': 'GBIF Darwin Core Extended',
        'attributes': {
            'recordedByID': {'type': 'keyword', 'label': 'Recorded by ID'},
            'identifiedByID': {'type': 'keyword', 'label': 'Identified by ID'},
        }
    },
    'ac': {
        '@context': 'http://rs.tdwg.org/ac/terms/',
        'name': 'Audubon Core',
        'attributes': {
            'physicalSetting': {'type': 'keyword', 'label': 'Physical setting'},
            'associatedSpecimenReference': {'type': 'keyword', 'label': 'Associated specimen reference'},
            'captureDevice': {'type': 'keyword', 'label': 'Capture device'},
            'resourceCreationTechnique': {'type': 'keyword', 'label': 'Resource creation technique'},
            'subjectOrientation': {'type': 'keyword', 'label': 'Subject orientation'},
            'subjectPart': {'type': 'keyword', 'label': 'Subject part'},
        }
    },
    'dc': {
        '@context': 'http://purl.org/dc/terms/',
        'name': 'DublinCore',
        'attributes': {
            'creator': {'type': 'keyword', 'label': 'Creator'},
            'rightsHolder': {'type': 'keyword', 'label': 'Rights holder'},
        }
    }
}
@slint slint changed the title record: add sorting of vocabulary fields for "custom" record: add grouping and sorting of vocabulary fields for "custom" Sep 23, 2021
@ppanero
Copy link

ppanero commented Mar 21, 2023

@slint should this be a custom UI serializer in ZenodRDM. because we will have the same issue as it is now.

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

Successfully merging a pull request may close this issue.

4 participants