:UserFeedback


Label

User feedback dataproduct

Description

This document describes the request and output parameters of user feedback dataproduct fetch.

Implementation  

{
    "openapi": "3.0.1",
    "info": {
        "contact": {
            "email": "support@cozify.fi"
        },
        "description": "This document describes the request and output parameters of feedback dataproduct fetch.",
        "title": "Feedback dataproduct",
        "version": "0.5"
    },
    "components": {
        "schemas": {
            "Platform of TrustTemperatureFeedback": {
                "description": "This data represents user feedback about room temperature.",
                "properties": {
                    "type": {
                        "description": "Type of the data, constant value \"temperatureFeedback\"",
                        "enum": ["temperatureFeedback"],
                        "type": "string"
                    },
                    "value": {
                        "description": "Feedback value from the user. (OK - The temperature in the room is fine., TOO_LOW - The room is too cold., TOO_HIGH - The room is too hot.)",
                        "enum": ["OK", "TOO_LOW", "TOO_HIGH"],
                        "type": "string"
                    }
                }
            },
            "Platform of TrustAirqualityFeedback": {
                "description": "This data represents user feedback about air quality in a room.",
                "properties": {
                    "type": {
                        "description": "Type of the data, constant value \"airqualityFeedback\"",
                        "enum": ["airqualityFeedback"],
                        "type": "string"
                    },
                    "value": {
                        "description": "Feedback value from the user. (OK - The air quality in the room is fine., NOT_OK - The air quality in the room is not satisfactory.)",
                        "enum": ["OK", "NOT_OK"],
                        "type": "string"
                    }
                }
            },
            "Platform of TrustTemperature": {
                "description": "Temperature in the room at the moment when the feedback was sent.",
                "properties": {
                    "type": {
                        "description": "Type of the data, constant value \"Temperature\"",
                        "enum": ["Temperature"],
                        "type": "string"
                    },
                    "value": {
                        "description": "Recorded temperature, Celsius",
                        "type": "number"
                    }
                }
            },
            "Platform of TrustHumidity": {
                "description": "Humidity in the room at the moment when the feedback was sent.",
                "properties": {
                    "type": {
                        "description": "Type of the data, constant value \"Humidity\"",
                        "enum": ["Humidity"],
                        "type": "string"
                    },
                    "value": {
                        "description": "Recorded humidity, percent",
                        "type": "number"
                    }
                }
            },
            "Platform of TrustCO2": {
                "description": "CO2 value in the room at the moment when the feedback was sent.",
                "properties": {
                    "type": {
                        "description": "Type of the data, constant value \"CO2\"",
                        "enum": ["CO2"],
                        "type": "string"
                    },
                    "value": {
                        "description": "Recorded CO2 value, ppm (parts per million)",
                        "type": "integer"
                    }
                }
            },
            "Platform of TrustUserFeedback": {
                "description": "This data class combines together the data from a single user feedback. It contains the given feedback and recorded temperature, humidity and co2 values in the room if they are available. The environment values are not mandatory, the room might not e.g. have any sensors installed.",
                "properties": {
                    "timestamp": {
                        "description": "Time for the user feedback. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                        "type": "string"
                    },
                    "value": {
                        "description": "List of feedback and environmental values.",
                        "items": {
                            "anyOf": [
                                {
                                    "$ref": "#/components/schemas/Platform of TrustTemperatureFeedback"
                                },
                                {
                                    "$ref": "#/components/schemas/Platform of TrustAirqualityFeedback"
                                },
                                {
                                    "$ref": "#/components/schemas/Platform of TrustTemperature"
                                },
                                {
                                    "$ref": "#/components/schemas/Platform of TrustHumidity"
                                },
                                {
                                    "$ref": "#/components/schemas/Platform of TrustCO2"
                                }
                            ],
                            "type": "object"
                        },
                        "type": "array"
                    }
                }
            },
            "Platform of TrustRoomFeedback": {
                "description": "This data class contains all user feedbacks for a single room.",
                "properties": {
                    "id": {
                        "description": "The unique Platform of Trust identifier of the room.",
                        "type": "string"
                    },
                    "data": {
                        "description": "List of user feedbacks for the room.",
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Platform of TrustUserFeedback"
                        }
                    }
                }
            },
            "DataProductOutput": {
                "description": "The standard response data for feedback dataproduct fetch. See https://docs.oftrust.net/#broker-v1-fetch-data-product",
                "properties": {
                    "data": {
                        "description": "The dataproduct specific response data for feedback dataproduct fetch.",
                        "properties": {
                            "@context": {
                                "description": "Standard Platform of Trust Context field",
                                "type": "string"
                            },
                            "items": {
                                "description": "List of feedback objects for all requested rooms",
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Platform of TrustRoomFeedback"
                                }
                            }
                        }
                    }
                }
            },
            "Platform of TrustFeedbackParameters": {
                "description": "Fetch parameters for user feedback request. The request needs a list of unique Platform of Trust room ids, start time for feedbacks and end time for feedbacks.",
                "properties": {
                    "ids": {
                        "description": "List of room ids.",
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "startTime": {
                        "description": "Start time for the user feedback fetch. Returned feedbacks can not be older than this time. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                        "type": "string"
                    },
                    "endTime": {
                        "description": "End time for the user feedback fetch. Returned feedbacks can not be newer than this time. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                        "type": "string"
                    }
                }
            },
            "DataProductParameters": {
                "description": "The standard request data for feedback dataproduct fetch. See https://docs.oftrust.net/#broker-v1-fetch-data-product",
                "properties": {
                    "@context": {
                        "description": "Standard Platform of Trust Context field for dataproduct fetch",
                        "type": "string"
                    },
                    "timestamp": {
                        "description": "Standard Platform of Trust timestamp field for dataproduct fetch",
                        "type": "string"
                    },
                    "productCode": {
                        "description": "Product code of user feedback dataproduct. Must have value \"user-feedback-1\"",
                        "enum": ["user-feedback-1"],
                        "type": "string"
                    },
                    "parameters": {
                        "description": "Parameters for user feedback fetch.",
                        "$ref": "#/components/schemas/Platform of TrustFeedbackParameters"
                    }
                }
            }
        }
    },
    "paths": {
        "/broker/v1/fetch-data-product": {
            "post": {
                "description": "The standard Platform of Trust dataproduct fetch.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DataProductParameters"
                            },
                            "example": {
                                "@context": "",
                                "timestamp": "2021-06-10T12:23:00.00+00:00",
                                "productCode": "user-feedback-1",
                                "ids": ["8012c6b7-d72c-4f41-9dd2-109d19d6732f"],
                                "startTime": "2021-06-10T00:00:00.00+00:00",
                                "endTime": "2021-06-10T12:23:00.00+00:00"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DataProductOutput"
                                },
                                "example": {
                                    "@context": "null",
                                    "signature": {
                                        "type": "RsaSignature2018",
                                        "created": "2021-06-16T08:11:16+00:00",
                                        "creator": "http://resources.cozify.fi/Platform of Trust/cozify_Platform of Trust_RS256.key.pub",
                                        "signatureValue": "I68+ur+da9IYB9JSj..."
                                    },
                                    "data": {
                                        "@context": "https://standards.oftrust.net/contexts/at_data_product_link.jsonld",
                                        "items": [
                                            {
                                                "data": [
                                                    {
                                                        "timestamp": "2021-06-10T08:12:34.341291+00:00",
                                                        "type": "UserFeedback",
                                                        "value": [
                                                            {
                                                                "type": "temperatureFeedback",
                                                                "value": "OK"
                                                            },
                                                            {
                                                                "type": "Temperature",
                                                                "value": 21.9
                                                            },
                                                            {
                                                                "type": "Humidity",
                                                                "value": 27.0
                                                            },
                                                            {
                                                                "type": "CO2",
                                                                "value": 572
                                                            }
                                                        ]
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T08:12:37.441522+00:00",
                                                        "type": "UserFeedback",
                                                        "value": [
                                                            {
                                                                "type": "airqualityFeedback",
                                                                "value": "NOT_OK"
                                                            },
                                                            {
                                                                "type": "Temperature",
                                                                "value": 21.9
                                                            },
                                                            {
                                                                "type": "Humidity",
                                                                "value": 27.0
                                                            },
                                                            {
                                                                "type": "CO2",
                                                                "value": 572
                                                            }
                                                        ]
                                                    }
                                                ],
                                                "id": "8012c6b7-d72c-4f41-9dd2-109d19d6732f"
                                            }
                                        ]
                                    }
                                }
                            }
                        },
                        "description": "User feedbacks matching the request parameters."
                    }
                }
            }
        }
    }
}