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
459 stars 250 forks source link

Add proper handling for outputTransmission #1654

Open francescoingv opened 1 month ago

francescoingv commented 1 month ago

Is your feature request related to a problem? Please describe. Currently the information outputTransmission returned by the process description (entry point processes/[process-id]) does not account for the information provided by the PROCESS_METADATA of the process, but is always returning the array ['value'].

While the default for outputTransmission is ['value'], the logic for the returned information should also consider if PROCESS_METADATA['outputTransmission'] is declared.

Describe the solution you'd like Alternatives for outputTransmission are:

The ability of the API to return a reference depends on if and where the following are defined:

There should be alternatives where to define the information required to return a reference. Where multiple alternatives are present they should be considered with the following priority:

  1. within the runtime of the process (e.g the information where to store the output may be provided as an input parameter)
  2. within the process definition (e.g. the configuration of the process may include process specific information where to store the output)
  3. within the manager definition (e.g. the manager configuration may include standard information where to store the output)
  4. if none of the above is present, then the API cannot return a reference.

For cases 1. and 2. the process will have a (instance or class) function the manager can call to store the output and to get the reference to pass back to the caller. For case 3. the manager will have a local function to call.

If 'reference' is within the PROCESS_METADATA['outputTransmission'], then the logic of the 'process description' will test for the presence of the functions.

Note 1: it is possible the process is not planned to return the output as a value, but only as a reference, e.g. a process producing a (possibly big) file stream. In this case 'outputTransmission'=['reference'].

Note 2: the returned link is not part of the API.

Note 3: the place where to store the output could be different from a file: it is implementation specific, and could also be (e.g.) a database.

Additional context By the next release it is possible for the process manager to receive the parameter outputs, and then process the request also accounting for the parameter outputTransmission. This should be reflected also in the process description.

Final I don't foresee any change in current signatures or required configuration. However, to make the API able to deal with a request with 'outputTransmission'='reference' then configuration changes are required in the configuration parameters for the ProcessManager, the Process, or both.

I propose to modify the following files:

francescoingv commented 1 month ago

@tomkralidis Please could you add the tag "OGC API - Processes"

francescoingv commented 1 month ago

Looking at the Draft version of OGC API - Processes - Part 1: Core (1.1 or 2.0) on OGC API - Processes

the output parameter outputTransmission disappeared.

The current Draft spells that: -) for Response requesting a single processing output, the server always returns the "value" -) for Response requesting multiple processing outputs the decision to return the output either as "value" or "reference" include handling the "return preference": ---) if return=representation then always return the output "value" ---) otherwise the server decide if should return an "hiperlink" or the "value".