From d9cf029d41cabd411e8e01027f1b6a8cc5fb0cb7 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Mon, 7 Nov 2022 13:20:13 -0800 Subject: [PATCH 1/2] Add barebone APIs for observation and event --- datacommons/event.py | 22 ++++++++++++++++++++++ datacommons/observation.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 datacommons/event.py create mode 100644 datacommons/observation.py diff --git a/datacommons/event.py b/datacommons/event.py new file mode 100644 index 0000000..832eaac --- /dev/null +++ b/datacommons/event.py @@ -0,0 +1,22 @@ +# Copyright 2022 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" API to get event data.""" + + +def event_series_within_place(): + return None + + +def event_point_within_place(): + return None diff --git a/datacommons/observation.py b/datacommons/observation.py new file mode 100644 index 0000000..ac86380 --- /dev/null +++ b/datacommons/observation.py @@ -0,0 +1,30 @@ +# Copyright 2022 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" API to get statistical observation data.""" + + +def observation_series(): + return None + + +def observation_series_of_entities_within_place(): + return None + + +def observation_point(): + return None + + +def observation_point_of_entities_within_place(): + return None \ No newline at end of file From f0d6464f2962d1718652eb38b0091a0c8b4e330c Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Mon, 7 Nov 2022 13:30:20 -0800 Subject: [PATCH 2/2] add params --- datacommons/event.py | 9 +++------ datacommons/observation.py | 14 ++++++++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/datacommons/event.py b/datacommons/event.py index 832eaac..ecacd1b 100644 --- a/datacommons/event.py +++ b/datacommons/event.py @@ -14,9 +14,6 @@ """ API to get event data.""" -def event_series_within_place(): - return None - - -def event_point_within_place(): - return None +def event_series_within_place(event_type: str, containing_place: str, + date: str): + return None \ No newline at end of file diff --git a/datacommons/observation.py b/datacommons/observation.py index ac86380..7da6e5c 100644 --- a/datacommons/observation.py +++ b/datacommons/observation.py @@ -13,18 +13,24 @@ # limitations under the License. """ API to get statistical observation data.""" +from typing import List -def observation_series(): + +def observation_series(variable: str, entities: List[str]): return None -def observation_series_of_entities_within_place(): +def observation_series_of_entities_within_place(variable: str, entity_type: str, + containing_place: str): return None -def observation_point(): +def observation_point(variable: str, entities: List[str], date: str = ""): return None -def observation_point_of_entities_within_place(): +def observation_point_of_entities_within_place(variable: str, + entity_type: str, + containing_place: str, + date: str = ""): return None \ No newline at end of file