Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
document["resources"] = [resource]
# subjects[]
if endnote_import_keywords and keywords:
for keyword in keywords.split():
document.set_key_with_value_type_in_list("subjects", keyword, "topic")
# title, title_alternative, title_abbreviated, title_translated
document["title"] = title
if title_alternative:
document["title_alternatives"] = [{"title": title_alternative}]
if title_abbreviated:
document["title_abbreviateds"] = [{"title": title_abbreviated}]
#logging.debug("# endnote_type: {}".format(endnote_type))
metajson_service.pretty_print_document(document)
return document
if series:
document["part_number"] = series
# isbn -> identifiers[].id_value = isbn
isbn = get_field(entry, 'isbn')
# file -> todo
myfile = get_field(entry, 'file')
# keywords -> todo
keywords_field = get_field(entry, 'keywords')
if keywords_field:
keywords = re.split(r',', get_field(entry, 'keywords').lower())
logging.info("# BibTeX type: {}".format(bibtex_type))
metajson_service.pretty_print_document(document)
return document
def mods_xmletree_to_metajson(mods, source, rec_id_prefix):
""" MODS xmletree -> MetaJSON Document """
if mods is None:
return None
# @version -> null
#mods_version = mods.get("version")
#logging.debug("# mods_version: {}".format(mods_version))
document = mods_root_or_related_item_to_metajson(mods, None)
# source
if source:
document["rec_source"] = source
metajson_service.pretty_print_document(document)
return document
resource["rec_modified_date"] = field_995.get_subfields('s')[0]
# $u -> notes[i]/value ex: Ceci est une note
if field_995.get_subfields('u'):
resource["notes"] = [{"value":field_995.get_subfields('u')[0],"language":"und"}]
# $v -> issue_number ex: Vol. 52, no 1>6, 2002 : vol. relié
if field_995.get_subfields('v'):
resource["issue_number"] = field_995.get_subfields('v')[0]
# $w -> issue_date ex: 2002
if field_995.get_subfields('w'):
resource["issue_date"] = field_995.get_subfields('w')[0]
if resource:
resources.append(resource)
if resources is not None:
document["resources"] = resources
metajson_service.pretty_print_document(document)
return document
# language
doc_language = None
if tei_languages:
languages = []
for tei_language in tei_languages:
language = tei_language.get("ident")
languages.append(language)
if languages:
document["languages"] = languages
doc_language = languages[0]
# title
document.update(get_tei_titles_to_metason(tei_titlestmt, doc_language))
metajson_service.pretty_print_document(document)
metajson_service.print_document(document)
return document
keywords = {main_language: []}
if subject_keywords:
keywords[main_language].extend(subject_keywords)
if subject_topics:
keywords[main_language].extend(subject_topics)
if subject_agents:
subject = Subject()
subject["agents"] = subject_agents
subjects.append(subject)
if subjects:
document["subjects"] = subjects
if keywords[main_language]:
document["keywords"] = keywords
logging.info("# Summon ContentType: {}".format(sum_type))
metajson_service.pretty_print_document(document)
return document
rec_type = ris_document_type_to_metajson_document_type[ris_type]
document["rec_type"] = rec_type
if ris_type in ris_document_type_to_metajson_document_is_part_of_type:
is_part_of_rec_type = ris_document_type_to_metajson_document_is_part_of_type[ris_type]
is_part_of = Document()
is_part_of["rec_type"] = is_part_of_rec_type
document["is_part_ofs"] = [is_part_of]
elif key == RIS_KEY_END:
# record end -> return the result
# verify the is_part_ofs[0]["title"]
if "is_part_ofs" in document and "title" not in document["is_part_ofs"][0] and "title_abbreviateds" in document["is_part_ofs"][0]:
document["is_part_ofs"][0]["title"] = document["is_part_ofs"][0]["title_abbreviateds"][0]["title"]
del document["is_part_ofs"][0]["title_abbreviateds"]
logging.info("# RIS type: {}".format(ris_type))
metajson_service.pretty_print_document(document)
yield document
else:
# process key value
#logging.debug("key: {}; value: {}".format(key, value))
if key == "ID":
document["rec_id"] = value
elif key in ["T1", "TI", "CT"] or (key == "BT" and ris_type in [RIS_TYPE_BOOK, RIS_TYPE_UNPB]):
# Title Primary -> title
document["title"] = value
elif key in ["JF", "JO"] or (key == "BT" and ris_type not in [RIS_TYPE_BOOK, RIS_TYPE_UNPB]):
# Title Secondary -> is_part_of["title"]
document.add_is_part_of_title(value)
elif key in ["JA", "J1", "J2", "T2"]:
# Title Secondary -> is_part_of["title_abbreviateds"][O]["title"]
document.add_is_part_of_title_abbreviated(value)
elif key == "T3":