geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
490 stars 260 forks source link

Add support for parameter Outputs of OGC API Processes #1602

Closed francescoingv closed 4 months ago

francescoingv commented 6 months ago

Overview

Allows the request parameter outputs to be passed on to the Processor.

The parameter outputs is passed to the Manager, which in turn pass it to the Processor, subject to the Processor being declared to support the outputs parameter:

class XxxProcessor(BaseProcessor):
    def __init__(self, processor_def):
        super().__init__(processor_def, PROCESS_METADATA)
        self.supports_outputs = True

The conditional parameter passing to the Processor grant backward compatibility for already developed Processors.

By default the Processor returns all the outputs defined into the section outputs of PROCESS_METADATA. If the processor receives the parameter outputs (a dictionary), then only the outputs with the key present into the parameter should be returned.

Each item of outputs may contain the property transmissionMode, which may take the value: value or reference. By default transmissionMode=value.

Related Issue / discussion

This PR address and solve issue #1420 This PR solve one Subset of issue #1285

Possibly the following issue (or enhancement) could be requested:

Additional information

This PR has a breaking signature in BaseManager.execute_process()

To check the Processor compatibility, the example processor HelloWorldProcessor has supports_outputs=True, while EchoProcessor has not supports_outputs property (default to False).

Dependency policy (RFC2)

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

francescoingv commented 6 months ago

I don't know "how to" address the requirements on "Updates to public demo". Please advice on the steps to verify this requirement.

francescoingv commented 5 months ago

As stated in online comments, it is not the aim nor the scope of the present PR (related to the issue #1420 ) to enable handling of multiple outputs. Currently the outputs parameter propagation it is only aimed to allow proper handling of the property transmissionMode. In my opinion the handling of the property transmissionMode may (and should) be handled within the manager.

I will rise a new issue with the target of handling the property transmissionMode when this PR will be eventually merged.

Given that a process can now produce multiple outputs, the process manager needs to also be updated in order to deal with it.

As stated inline, I have no problem for this, but tried to follow current practice to minimize impact on current development. A comment from the maintainers (@tomkralidis ?) is required.

Additionally, as mentioned inline, I would not introduce the supports_outputs flag in the BaseProcessor, but I understand the rationale for including it. I guess this is up for discussion.

tomkralidis commented 4 months ago

2024-05-10: as discussed during the pygeoapi online meeting, lgtm.