Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit d9189f5

Browse files
committed
expose more basic properties from algorithm catalog
1 parent 4f022b6 commit d9189f5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/esa_apex_toolbox/algorithms.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class LINK_REL:
12-
UDP = "udp"
12+
UDP = "openeo-process"
1313

1414

1515
def _load_json_resource(src: Union[dict, str, Path]) -> dict:
@@ -51,7 +51,7 @@ def from_link_object(cls, data: dict) -> UdpLink:
5151
if "rel" not in data:
5252
raise InvalidMetadataError("Missing 'rel' attribute in link object")
5353
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}")
5555
if "type" in data and data["type"] != "application/json":
5656
raise InvalidMetadataError(f"Expected link with type='application/json' but got {data['type']!r}")
5757
if "href" not in data:
@@ -68,6 +68,8 @@ class Algorithm:
6868
title: Optional[str] = None
6969
description: Optional[str] = None
7070
udp_link: Optional[UdpLink] = None
71+
license: Optional[str] = None
72+
organization: Optional[str] = None
7173
# TODO more fields
7274

7375
@classmethod
@@ -96,11 +98,18 @@ def from_ogc_api_record(cls, src: Union[dict, str, Path]) -> Algorithm:
9698
# TODO: is having a UDP link a requirement?
9799
udp_link = udp_links[0] if udp_links else None
98100

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+
99106
return cls(
100107
id=data["id"],
101108
title=properties.get("title"),
102109
description=properties.get("description"),
103110
udp_link=udp_link,
111+
license=service_license,
112+
organization = pi_org
104113
)
105114

106115

0 commit comments

Comments
 (0)