def get_issue_date(self, obj): """Get issue date.""" metadata = obj['metadata']['pubdate']['attribute_value'] if metadata is None: return missing else: datedata = from_isodate(metadata) return {'date-parts': [[datedata.year, datedata.month, datedata.day]]} if datedata else missing
def test_apa_citation(self, config, create_record): """Integration test with the citation serializer. This validates we are passing the right input and getting a citation from the underlying library. Formatting of the citation is left to the 3rd-party citeproc-py library. """ record = create_record({ 'authors': [{ 'first_name': 'Jane', 'middle_name': 'Rachel', 'last_name': 'Doe', 'full_name': 'Doe, Jane Rachel' }, { 'first_name': 'John', 'last_name': 'Smith', 'full_name': 'Smith, John' }], 'resource_type': { 'general': 'dataset', 'specific': 'dataset', 'full_hierarchy': ['dataset'] } }) record['doi'] = '10.5072/qwer-tyui' pid = PersistentIdentifier.get( record['_deposit']['pid']['type'], record['_deposit']['pid']['value'], ) citation_str = citeproc_v1.serialize(pid, record, style='apa') assert citation_str == ("Doe, J., & Smith, J. ({year}). " "A title [Data set]. {publisher}. " "http://doi.org/10.5072/qwer-tyui".format( year=from_isodate(record.created).year, publisher=config['DOI_PUBLISHER']))
def accessright_description(value, embargo_date=None): """Get a description for access right.""" return AccessRight.as_description(AccessRight.get(value, embargo_date), from_isodate(embargo_date))
def accessright_description(value, embargo_date=None): """Get a description for access right.""" return AccessRight.as_description( AccessRight.get(value, embargo_date), from_isodate(embargo_date) )
def get_issue_date(self, obj): """Get a date in list format.""" d = from_isodate(obj['metadata'].get('publication_date')) return {'date-parts': [[d.year, d.month, d.day]]} if d else missing
def get_issue_date(self, obj): """Get a date in list format.""" d = from_isodate(obj['metadata'].get('publication_date')) return {'date-parts': [[d.year, d.month, d.day]]} if d else missing
def get_issue_date(self, data): """Get a date in list format.""" d = from_isodate(data['created']) return {'date-parts': [[d.year, d.month, d.day]]}