@@ -63,72 +63,6 @@ def fetch(
6363 # Send the request
6464 return ObservationResponse .from_json (self .post (payload ))
6565
66- def fetch_latest_observations (
67- self ,
68- variable_dcids : str | list [str ],
69- entity_dcids : Optional [str | list [str ]] = None ,
70- entity_expression : Optional [str ] = None ,
71- * ,
72- select : Optional [list [ObservationSelect | str ]] = None ,
73- filter_facet_domains : Optional [str | list [str ]] = None ,
74- filter_facet_ids : Optional [str | list [str ]] = None ,
75- ) -> ObservationResponse :
76- """
77- Fetches the latest observations for the given variable and entity.
78-
79- Args:
80- variable_dcids (str | list[str]): One or more variable IDs for the data.
81- entity_dcids (Optional[str | list[str]]): One or more entity IDs to filter the data.
82- entity_expression (Optional[str]): A string expression to filter entities.
83- select (Optional[list[ObservationSelect | str]]): Fields to include in the response.
84- If not provided, defaults to ["date", "variable", "entity", "value"].
85- filter_facet_domains: Optional[str | list[str]: One or more domain names to filter the data.
86- filter_facet_ids: Optional[str | list[str]: One or more facet IDs to filter the data.
87-
88- Returns:
89- ObservationResponse: The response object containing observations for the specified query.
90- """
91- return self .fetch (
92- variable_dcids = variable_dcids ,
93- date = ObservationDate .LATEST ,
94- entity_dcids = entity_dcids ,
95- entity_expression = entity_expression ,
96- filter_facet_domains = filter_facet_domains ,
97- filter_facet_ids = filter_facet_ids ,
98- select = [s for s in ObservationSelect ] if not select else select ,
99- )
100-
101- def fetch_latest_observations_by_entity (
102- self ,
103- variable_dcids : str | list [str ],
104- entity_dcids : str | list [str ],
105- * ,
106- select : Optional [list [ObservationSelect | str ]] = None ,
107- filter_facet_domains : Optional [str | list [str ]] = None ,
108- filter_facet_ids : Optional [str | list [str ]] = None ,
109- ) -> ObservationResponse :
110- """Fetches the latest observations for the given variable and entities.
111-
112- Args:
113- variable_dcids (str | list[str]): One or more variable IDs for the data.
114- entity_dcids (str | list[str]): One or more entity IDs to filter the data.
115- select (Optional[list[ObservationSelect | str]]): Fields to include in the response.
116- If not provided, defaults to ["date", "variable", "entity", "value"].
117- filter_facet_domains: Optional[str | list[str]: One or more domain names to filter the data.
118- filter_facet_ids: Optional[str | list[str]: One or more facet IDs to filter the data.
119-
120- Returns:
121- ObservationResponse: The response object containing observations for the specified query.
122- """
123-
124- return self .fetch_latest_observations (
125- variable_dcids = variable_dcids ,
126- entity_dcids = entity_dcids ,
127- select = [s for s in ObservationSelect ] if not select else select ,
128- filter_facet_domains = filter_facet_domains ,
129- filter_facet_ids = filter_facet_ids ,
130- )
131-
13266 def fetch_observations_by_entity_type (
13367 self ,
13468 date : ObservationDate | str ,
@@ -185,7 +119,7 @@ def fetch_observations_by_entity_type(
185119 filter_facet_ids = filter_facet_ids ,
186120 )
187121
188- def fetch_observations_by_entity (
122+ def fetch_observations_by_entity_dcid (
189123 self ,
190124 date : ObservationDate | str ,
191125 entity_dcids : str | list [str ],
@@ -218,7 +152,7 @@ def fetch_observations_by_entity(
218152
219153 ```python
220154 api = API()
221- ObservationEndpoint(api).fetch_observations_by_entity (
155+ ObservationEndpoint(api).fetch_observations_by_entity_dcid (
222156 date="all",
223157 entity_dcids="country/NGA",
224158 variable_dcids="sdg/SI_POV_DAY1"
0 commit comments