initial stage

This commit is contained in:
Giambattista Bloisi 2024-06-27 18:24:24 +02:00
parent a4c75d072b
commit b0f8161e80
1 changed files with 7 additions and 0 deletions

View File

@ -115,18 +115,23 @@ def isEmpty(current_value: Dict[str, Any], labels: List[str]) -> bool:
# #
def filter_product(p: dict) -> bool: def filter_product(p: dict) -> bool:
if isEmpty(p, ["titles", "none"]): if isEmpty(p, ["titles", "none"]):
print("missing title")
return True return True
if isEmpty(p, ["firstPublishDate"]): if isEmpty(p, ["firstPublishDate"]):
print("missing date")
return True return True
if p['product_type'] == "literature": if p['product_type'] == "literature":
if isEmpty(p, ["abstracts", "none"]): if isEmpty(p, ["abstracts", "none"]):
print("missing abstracts")
return True return True
if isEmpty(p, ["contributions", "person", "local_identifier"]): if isEmpty(p, ["contributions", "person", "local_identifier"]):
print("missing creators")
return True return True
elif p['product_type'] in ["research data", "other"]: elif p['product_type'] in ["research data", "other"]:
if isEmpty(p, ["contributions", "person", "local_identifier"]): if isEmpty(p, ["contributions", "person", "local_identifier"]):
print("missing creators")
return True return True
return False return False
@ -135,3 +140,5 @@ def filter_product(p: dict) -> bool:
filter_entities = { filter_entities = {
"products": filter_product "products": filter_product
} }