9
9
10
10
11
11
class LINK_REL :
12
- UDP = "udp "
12
+ UDP = "openeo-process "
13
13
14
14
15
15
def _load_json_resource (src : Union [dict , str , Path ]) -> dict :
@@ -51,7 +51,7 @@ def from_link_object(cls, data: dict) -> UdpLink:
51
51
if "rel" not in data :
52
52
raise InvalidMetadataError ("Missing 'rel' attribute in link object" )
53
53
if data ["rel" ] != LINK_REL .UDP :
54
- raise InvalidMetadataError (f"Expected link with rel='udp ' but got { data ['rel' ]!r} " )
54
+ raise InvalidMetadataError (f"Expected link with rel='{ LINK_REL . UDP } ' but got { data ['rel' ]!r} " )
55
55
if "type" in data and data ["type" ] != "application/json" :
56
56
raise InvalidMetadataError (f"Expected link with type='application/json' but got { data ['type' ]!r} " )
57
57
if "href" not in data :
@@ -68,6 +68,8 @@ class Algorithm:
68
68
title : Optional [str ] = None
69
69
description : Optional [str ] = None
70
70
udp_link : Optional [UdpLink ] = None
71
+ license : Optional [str ] = None
72
+ organization : Optional [str ] = None
71
73
# TODO more fields
72
74
73
75
@classmethod
@@ -96,11 +98,18 @@ def from_ogc_api_record(cls, src: Union[dict, str, Path]) -> Algorithm:
96
98
# TODO: is having a UDP link a requirement?
97
99
udp_link = udp_links [0 ] if udp_links else None
98
100
101
+ pis = [ c for c in properties .get ("contacts" ,[]) if "principal investigator" in c .get ("roles" ,[]) ]
102
+ pi_org = pis [0 ].get ("organization" , None ) if pis else None
103
+
104
+ service_license = data .get ("license" ,None )
105
+
99
106
return cls (
100
107
id = data ["id" ],
101
108
title = properties .get ("title" ),
102
109
description = properties .get ("description" ),
103
110
udp_link = udp_link ,
111
+ license = service_license ,
112
+ organization = pi_org
104
113
)
105
114
106
115
0 commit comments