Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support time window in the past in the APIexposure of data in the past is added #60

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Repository to describe, develop, document and test the Population Density Data A
## Scope
* Service APIs for “Population Density Data” (see APIBacklog.md)
* It provides the customer with the ability to:
* The service enables developers with the capability to get dynamic population density data in a specific area for a future date&time, considering anonymized information of the network connected devices in the requested area at the flight time.
* The service enables developers with the capability to get dynamic population density data in a specific area for a specified date&time, considering anonymized information of the network connected devices in the requested area at the flight time.
* Use Case (1): Providing BVLOS flight the data to meet SORA 2.5 requirements in terms of intrinsic Ground Risk Class (iGRC).
* Use Case (2): Providing data to identify if the ground risk class for a given drone flight is acceptable for the time of the flight, or an alternative time should be considered to lower the risk.
* Service Inputs: Area of the interest. Date & time (future) range.
* Service Inputs: Area of the interest. Date & time range.
* Service Outputs: maximum, average and minimum population density value for the given area, and interval corresponding to the valid range of that value. (space and time maps).
* NOTE: The scope of this API family should be limited (at least at a first stage) to 4G and 5G.
* Describe, develop, document and test the APIs (with 1-2 Telcos)
Expand Down
14 changes: 10 additions & 4 deletions code/API_definitions/population-density-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ info:
# Introduction

With the Population Density Data API the customer can retrieve population density estimations
for a specific area at the current or a future period of time. The estimation considers historical
for a specific area at the current or a specified period of time. The estimation considers historical
anonymized information of the network connected devices in the requested
area.

Expand Down Expand Up @@ -53,8 +53,7 @@ info:
(exact definitions of minimum and maximum are estimation algorithm specific).


These values are calculated based on historical data and/or prediction models trained
on such data.
These values are calculated based on historical data, prediction models, and population estimation models. The requested interval must either be completely in the future or in the past.


The polygon specifying an area of interest must comply with certain restrictions,
Expand Down Expand Up @@ -294,7 +293,7 @@ components:
Start date time. It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6)
and must have time zone. Recommended format is yyyy-MM-dd'T'HH:mm:ss.SSSZ
(i.e. which allows 2023-07-03T14:27:08.312+02:00 or 2023-07-03T12:27:08.312Z)
The minimum startTime is the time of the request.
The minimum startTime must cover at least 3 months before the request time.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not clear for me (but perhaps this is my English).
Do we mean that request in the past must query information older than 3 months or the contrary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was to declare a minimal time frame everyone must support. I.e. everyone who implements API must support 3 months, if someone exposes 1 year - its a bonus.

endTime:
type: string
format: date-time
Expand Down Expand Up @@ -623,6 +622,7 @@ components:
- Indicated `startTime` is greater than the maximum allowed ("code": "POPULATION_DENSITY_DATA.MAX_STARTTIME_EXCEEDED", "message": "Indicated startTime is greater than the maximum allowed")
- Indicated `startTime` is earlier than the minimum allowed ("code": "POPULATION_DENSITY_DATA.MIN_STARTTIME_EXCEEDED", "message": "Indicated startTime is earlier than the minimum allowed")
- Indicated `endTime` is earlier than the `startTime` ("code": "POPULATION_DENSITY_DATA.INVALID_END_DATE", "message": "Indicated endTime is earlier than the startTime")
- Indicated time period is partially in the past and partially in the future ("code": "POPULATION_DENSITY_DATA.INVALID_TIME_PERIOD", "message": "time period is partially in the past and partially in the future")
- Indicated time period is greater than the maximum allowed (More than maximum hours between startTime and endTime) ("code": "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED", "message": "Indicated time period is greater than the maximum allowed (More than maximum hours between startTime and endTime)")
- Indicated cell precision (Geohash level) is not supported ("code": "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION", "message": "Indicated cell precision (Geohash level) is not supported")
- Indicated combination of area, time interval and precision is too big for a sync response ("code": "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE", "message": "Indicated combination of area, time interval and precision is too big for a sync response")
Expand Down Expand Up @@ -683,6 +683,12 @@ components:
message: >-
Indicated time period is greater than the maximum allowed
(More than maximum hours between startTime and endTime)
InvalidPeriodIssue:
value:
status: 400
code: POPULATION_DENSITY_DATA.INVALID_TIME_PERIOD
message: >-
Indicated time period is partially in the past and partially in the future
PrecisionNotSupportedIssue:
value:
status: 400
Expand Down
68 changes: 49 additions & 19 deletions code/Test_definitions/population-density-data.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Feature: CAMARA Population Density Data API, v0.1.1
@population_density_data_retrievePopulationDensity_01_supported_area_success_scenario
Scenario: Validate success response for a supported area request
Given the request body property "$.area" is set to a valid testing area within supported regions
And the request body property "$.startDate" is set to a valid testing future date
And the request body property "$.endDate" is set to a valid testing future date later than body property "$.startDate"
And the request body property "$.startDate" is set to a valid testing date
And the request body property "$.endDate" is set to a valid testing date later than body property "$.startDate"
When the request "retrievePopulationDensity" is sent
Then the response status code is 200
And the response header "Content-Type" is "application/json"
Expand Down Expand Up @@ -106,9 +106,28 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse"

@population_density_data_retrievePopulationDensity_06_supported_area_past_success_scenario
Scenario: Validate success response for a supported area request
Given the request body property "$.area" is set to a valid testing area within supported regions
And the request body property "$.startDate" is set to a valid testing date in the past
And the request body property "$.endDate" is set to a valid testing past date later than body property "$.startDate"
When the request "retrievePopulationDensity" is sent
Then the response status code is 200
And the response header "Content-Type" is "application/json"
And the response header "x-correlator" has same value as the request header "x-correlator"
And the response body complies with the OAS schema at "/components/schemas/PopulationDensityResponse"
And the response property "$.status" value is "SUPPORTED_AREA"
And the response property "$.timedPopulationDensityData[*].startTime" is equal to or later than request body property "$.startDate"
And the response property "$.timedPopulationDensityData[*].endTime" is equal to or earlier than request body property "$.endDate"
And the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" is equal to "LOW_DENSITY" or "DENSITY_ESTIMATION"
And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].minPplDensity" is included in the response
And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].pplDensity" is included in the response
And for items with response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].dataType" == "DENSITY_ESTIMATION", the response property "$.timedPopulationDensityData[*].cellPopulationDensityData[*].populationDensityData[*].maxPplDensity" is included in the response


# Generic errors

@population_density_data_retrievePopulationDensity_06_missing_required_property
@population_density_data_retrievePopulationDensity_07_missing_required_property
Scenario Outline: Error response for missing required property in request body
Given the request body property "<required_property>" is not included
When the request "retrievePopulationDensity" is sent
Expand All @@ -124,7 +143,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
| $.startDate |
| $.endDate |

@population_density_data_retrievePopulationDensity_07_invalid_date_format
@population_density_data_retrievePopulationDensity_08_invalid_date_format
Scenario Outline: Error 400 when the datetime format is not RFC-3339
Given the request body property "<date_property>" is not set to a valid RFC-3339 date-time
When the request "retrievePopulationDensity" is sent
Expand All @@ -139,7 +158,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
| $.startDate |
| $.endDate |

@population_density_data_retrievePopulationDensity_08_invalid_precision
@population_density_data_retrievePopulationDensity_09_invalid_precision
Scenario: Error 400 when precision is not a number between 1 and 12
Given the request body property "$.precision" is not set to a number between 1 and 12
When the request "retrievePopulationDensity" is sent
Expand All @@ -151,7 +170,7 @@ Feature: CAMARA Population Density Data API, v0.1.1


# PLAIN and REFRESHTOKEN are considered in the schema so INVALID_ARGUMENT is not expected
@population_density_data_retrievePopulationDensity_09_invalid_sink_credential
@population_density_data_retrievePopulationDensity_10_invalid_sink_credential
Scenario Outline: Invalid credential
Given the request body property "$.sinkCredential.credentialType" is set to "<unsupported_credential_type>"
When the request "retrievePopulationDensity" is sent
Expand All @@ -169,7 +188,7 @@ Feature: CAMARA Population Density Data API, v0.1.1

# Only "bearer" is considered in the schema so a generic schema validator may fail and generate a 400 INVALID_ARGUMENT without further distinction,
# and both could be accepted
@population_density_data_retrievePopulationDensity_10_sink_credential_invalid_token
@population_density_data_retrievePopulationDensity_11_sink_credential_invalid_token
Scenario: Invalid token
Given the request body property "$.sinkCredential.accessTokenType" is set to a value other than "bearer"
When the request "retrievePopulationDensity" is sent
Expand All @@ -180,7 +199,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "INVALID_TOKEN" or "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_10_expired_access_token
@population_density_data_retrievePopulationDensity_12_expired_access_token
Scenario: Error response for expired access token
Given an expired access token
And the request body is set to a valid request body
Expand All @@ -191,7 +210,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_11_invalid_access_token
@population_density_data_retrievePopulationDensity_13_invalid_access_token
Scenario: Error response for invalid access token
Given an invalid access token
And the request body is set to a valid request body
Expand All @@ -202,7 +221,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "UNAUTHENTICATED"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_12_missing_authorization_header
@population_density_data_retrievePopulationDensity_14_missing_authorization_header
Scenario: Error response for no header "Authorization"
Given the header "Authorization" is not sent
And the request body is set to a valid request body
Expand All @@ -217,7 +236,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
# API Specific Errors

# An area that does not form a polygon is a straight line or a set of points with same coordinates.
@population_density_data_retrievePopulationDensity_13_non_polygonal_area
@population_density_data_retrievePopulationDensity_15_non_polygonal_area
Scenario: Error 400 when the requested area is not a polygon
Given the request body property "$.area.boundry" is set to an array of coordinates that does not form a polygon
When the request "retrievePopulationDensity" is sent
Expand All @@ -227,7 +246,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_14_too_complex_area
@population_density_data_retrievePopulationDensity_16_too_complex_area
Scenario: Error 400 when the requested area is too complex
Given the request body property "$.area.boundary" is set to an array of coordinates that form a too complex area
When the request "retrievePopulationDensity" is sent
Expand All @@ -237,7 +256,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_AREA"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_15_min_start_date_exceeded
@population_density_data_retrievePopulationDensity_17_min_start_date_exceeded
Scenario: Error 400 when startDate is set to a date earlier than the minimum allowed
Given the request body property "$.startDate" is set to a date earlier than the minimum allowed
When the request "retrievePopulationDensity" is sent
Expand All @@ -247,7 +266,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.MIN_STARTDATE_EXCEEDED"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_16_max_start_date_exceeded
@population_density_data_retrievePopulationDensity_18_max_start_date_exceeded
Scenario: Error 400 when startDate is set to a date later than the maximum allowed
Given the request body property "$.startDate" is set to a date later than the maximum allowed
When the request "retrievePopulationDensity" is sent
Expand All @@ -257,7 +276,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_STARTDATE_EXCEEDED"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_17_invalid_end_date
@population_density_data_retrievePopulationDensity_19_invalid_end_date
Scenario: Error 400 when endDate is set to a date earlier than startDate
Given the request body property "$.endDate" is set to a date earlier than request body property "$.startDate"
When the request "retrievePopulationDensity" is sent
Expand All @@ -267,7 +286,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_END_DATE"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_18_max_time_period_exceeded
@population_density_data_retrievePopulationDensity_20_max_time_period_exceeded
Scenario: Error 400 when indicated time period is greater than the maximum allowed
Given the request body property "$.startDate" is set to a valid testing future
And the request body property "$.endDate" is set to a future date that exceeds the supported duration from the start date.
Expand All @@ -278,7 +297,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.MAX_TIME_PERIOD_EXCEEDED"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_19_unsupported_precision
@population_density_data_retrievePopulationDensity_21_unsupported_precision
Scenario: Error 400 when precision is set to a valid but not supported value
Given the request body property "$.precision" is set to a valid but not supported value
When the request "retrievePopulationDensity" is sent
Expand All @@ -288,7 +307,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_PRECISION"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_20_too_big_synchronous_response
@population_density_data_retrievePopulationDensity_22_too_big_synchronous_response
Scenario: Error 400 when the response is too big for a sync response
Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous response
When the request "retrievePopulationDensity" is sent
Expand All @@ -298,7 +317,7 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPORTED_SYNC_RESPONSE"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_21_too_big_request
@population_density_data_retrievePopulationDensity_23_too_big_request
Scenario: Error 400 when the response is too big for a sync adn async response
Given the request body properties "$.area.boundry", "$.startDate", "$.endDate" and "$.precision" are set to valid values but generate a response too big for a synchronous and asynchronous response
When the request "retrievePopulationDensity" is sent
Expand All @@ -307,3 +326,14 @@ Feature: CAMARA Population Density Data API, v0.1.1
And the response property "$.status" is 400
And the response property "$.code" is "POPULATION_DENSITY_DATA.UNSUPPPORTED_REQUEST"
And the response property "$.message" contains a user friendly text

@population_density_data_retrievePopulationDensity_24_timeframe_crosses_request_time
Scenario: Error 400 when startDate is set to a date in the past and the endDate is set to a date in the future
Given the request body property "$.startDate" is set to a date in the past
And the request body property "$.endDate" is set to a date in the future
When the request "retrievePopulationDensity" is sent
Then the response status code is 400
And the response header "Content-Type" is "application/json"
And the response property "$.status" is 400
And the response property "$.code" is "POPULATION_DENSITY_DATA.INVALID_TIME_PERIOD"
And the response property "$.message" contains a user friendly text
Loading