Skip to content

Commit

Permalink
Fixup f959091
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Dec 11, 2024
1 parent aaf8386 commit 428562f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/esa_apex_toolbox/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def from_link_object(cls, data: dict) -> UdpLink:
title=data.get("title"),
)


@dataclasses.dataclass(frozen=True)
class ServiceLink:
href: str
Expand Down Expand Up @@ -123,23 +124,23 @@ def from_ogc_api_record(cls, src: Union[dict, str, Path]) -> Algorithm:
udp_link = udp_links[0] if udp_links else None

service_links = [ServiceLink.from_link_object(link) for link in links if link.get("rel") == LINK_REL.SERVICE]
if len(udp_links) == 0:
raise InvalidMetadataError("No service links found, the algorithm requires at least one valid service that is known to execute it.")


if len(service_links) == 0:
raise InvalidMetadataError(
"No service links found, the algorithm requires at least one valid service that is known to execute it."
)

pis = [ c for c in properties.get("contacts",[]) if "principal investigator" in c.get("roles",[]) ]
pis = [c for c in properties.get("contacts", []) if "principal investigator" in c.get("roles", [])]
pi_org = pis[0].get("organization", None) if pis else None

service_license = data.get("license",None)
service_license = data.get("license", None)
return cls(
id=data["id"],
title=properties.get("title"),
description=properties.get("description"),
udp_link=udp_link,
service_links=service_links,
license=service_license,
organization = pi_org
organization=pi_org,
)


Expand Down

0 comments on commit 428562f

Please sign in to comment.