lot1-kickoff/airflow/dags/EOSC_entity_trasform.py

25 lines
572 B
Python
Raw Normal View History

2024-03-25 17:54:23 +01:00
def map_access_right(ar: str) -> str:
match ar:
case 'open':
return 'Open Access'
case 'closed':
return 'Closed'
case 'embargo':
return 'Embargo'
case 'restricted':
return 'Restricted'
case _:
return ''
def trasform_product(p: dict) -> dict:
p['accessRights'] = list(
filter(lambda ar: ar != '', map(lambda m: map_access_right(m.get('access_right')), p.get('manifestations'))))
return p
transform_entities = {
# 'products': trasform_product
}