eolas-data 1.3.0__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eolas-data
3
- Version: 1.3.0
3
+ Version: 1.5.0
4
4
  Summary: Python client for the eolas.fyi statistical data API (NZ, Australia, OECD)
5
5
  Project-URL: Homepage, https://eolas.fyi
6
6
  Project-URL: Documentation, https://docs.eolas.fyi/
@@ -203,6 +203,29 @@ class Client:
203
203
  """Fetch a WorkSafe NZ dataset."""
204
204
  return self._get_source(name, "WorkSafe NZ", **kwargs)
205
205
 
206
+ def immigration(self, name, **kwargs) -> Dataset:
207
+ """Fetch an Immigration NZ dataset."""
208
+ return self._get_source(name, "Immigration NZ", **kwargs)
209
+
210
+ def lris(self, name, **kwargs) -> Dataset:
211
+ """Fetch a Manaaki Whenua LRIS dataset (land cover, soil, protected areas).
212
+
213
+ Examples::
214
+
215
+ client.lris("lcdb_v6_mainland") # current NZ land cover (~543k polygons)
216
+ client.lris("nzlum_v03") # NZ Land Use Management v0.3
217
+ client.lris("pan_nz_2025_draft") # protected areas (Draft, 2025)
218
+
219
+ Notes:
220
+ LCDB v3.0–v4.1 are deprecated vintages, retained for longitudinal
221
+ analysis. LCDB v5 is superseded by v6 but still served.
222
+ PAN-NZ 2025 was marked Draft at the time of ingestion (2026-05-12).
223
+ Source: https://lris.scinfo.org.nz
224
+ Licence: CC-BY 4.0 International (LCDB v5/v6, NZLUM, PBC, PAN-NZ);
225
+ CC-BY 3.0 NZ (LCDB v3/v4 vintages). Attribution: Manaaki Whenua.
226
+ """
227
+ return self._get_source(name, "Manaaki Whenua / LRIS", **kwargs)
228
+
206
229
  def _get_source(self, name, source: str, **kwargs) -> Dataset:
207
230
  df = self.get(name, **kwargs)
208
231
  df.eolas_source = source
@@ -271,6 +294,11 @@ class Client:
271
294
  if "date" in df.columns:
272
295
  df["date"] = pd.to_datetime(df["date"])
273
296
 
297
+ # API streams from Iceberg in file order, not chronological — sort here so
298
+ # callers can `df.plot(x="date", y="value")` without seeing zigzag lines.
299
+ if "date" in df.columns:
300
+ df = df.sort_values("date", kind="stable").reset_index(drop=True)
301
+
274
302
  result = Dataset(df)
275
303
  result.eolas_name = name
276
304
  result.eolas_source = ""
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "eolas-data"
7
- version = "1.3.0"
7
+ version = "1.5.0"
8
8
  description = "Python client for the eolas.fyi statistical data API (NZ, Australia, OECD)"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -101,6 +101,19 @@ def test_get_returns_dataset(client):
101
101
  assert df.eolas_name == "nz_cpi"
102
102
 
103
103
 
104
+ @resp_lib.activate
105
+ def test_get_sorts_rows_by_date(client):
106
+ # API streams Iceberg in file order, not chronological — client must sort.
107
+ unsorted = [
108
+ {"date": "2023-04-01", "period": "2023Q2", "value": 101.5},
109
+ {"date": "2022-01-01", "period": "2022Q1", "value": 99.0},
110
+ {"date": "2023-01-01", "period": "2023Q1", "value": 100.0},
111
+ ]
112
+ resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": unsorted})
113
+ df = client.get("nz_cpi")
114
+ assert list(df["date"].dt.strftime("%Y-%m-%d")) == ["2022-01-01", "2023-01-01", "2023-04-01"]
115
+
116
+
104
117
  @resp_lib.activate
105
118
  def test_get_passes_date_params(client):
106
119
  resp_lib.add(resp_lib.GET, f"{BASE}/v1/datasets/nz_cpi/data", json={"data": RECORDS})
File without changes
File without changes
File without changes
File without changes