community-streamflow-service 0.1.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.
Files changed (222) hide show
  1. community_streamflow_service-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +45 -0
  2. community_streamflow_service-0.1.0/.github/ISSUE_TEMPLATE/provider_request.md +39 -0
  3. community_streamflow_service-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +35 -0
  4. community_streamflow_service-0.1.0/.github/workflows/acquire.yml +144 -0
  5. community_streamflow_service-0.1.0/.github/workflows/ci.yml +37 -0
  6. community_streamflow_service-0.1.0/.github/workflows/docs.yml +47 -0
  7. community_streamflow_service-0.1.0/.gitignore +42 -0
  8. community_streamflow_service-0.1.0/CHANGELOG.md +38 -0
  9. community_streamflow_service-0.1.0/CITATION.cff +26 -0
  10. community_streamflow_service-0.1.0/CODE_OF_CONDUCT.md +85 -0
  11. community_streamflow_service-0.1.0/CONTRIBUTING.md +92 -0
  12. community_streamflow_service-0.1.0/LICENSE +674 -0
  13. community_streamflow_service-0.1.0/PKG-INFO +183 -0
  14. community_streamflow_service-0.1.0/README.md +128 -0
  15. community_streamflow_service-0.1.0/csfs.yaml +61 -0
  16. community_streamflow_service-0.1.0/docs/architecture.md +134 -0
  17. community_streamflow_service-0.1.0/docs/catalog.md +139 -0
  18. community_streamflow_service-0.1.0/docs/cli.md +139 -0
  19. community_streamflow_service-0.1.0/docs/index.md +60 -0
  20. community_streamflow_service-0.1.0/docs/python-api.md +148 -0
  21. community_streamflow_service-0.1.0/docs/quickstart.md +130 -0
  22. community_streamflow_service-0.1.0/docs/reference.md +44 -0
  23. community_streamflow_service-0.1.0/inventory/providers.yaml +1431 -0
  24. community_streamflow_service-0.1.0/mkdocs.yml +65 -0
  25. community_streamflow_service-0.1.0/pyproject.toml +130 -0
  26. community_streamflow_service-0.1.0/scripts/build_database.sh +82 -0
  27. community_streamflow_service-0.1.0/src/csfs/__init__.py +5 -0
  28. community_streamflow_service-0.1.0/src/csfs/api/__init__.py +0 -0
  29. community_streamflow_service-0.1.0/src/csfs/api/app.py +145 -0
  30. community_streamflow_service-0.1.0/src/csfs/cli/__init__.py +0 -0
  31. community_streamflow_service-0.1.0/src/csfs/cli/main.py +528 -0
  32. community_streamflow_service-0.1.0/src/csfs/connectors/__init__.py +0 -0
  33. community_streamflow_service-0.1.0/src/csfs/connectors/_kiwis.py +317 -0
  34. community_streamflow_service-0.1.0/src/csfs/connectors/adhi.py +974 -0
  35. community_streamflow_service-0.1.0/src/csfs/connectors/afghanistan_usgs.py +331 -0
  36. community_streamflow_service-0.1.0/src/csfs/connectors/argentina_snih.py +180 -0
  37. community_streamflow_service-0.1.0/src/csfs/connectors/australia_bom.py +280 -0
  38. community_streamflow_service-0.1.0/src/csfs/connectors/austria_ehyd.py +207 -0
  39. community_streamflow_service-0.1.0/src/csfs/connectors/base.py +146 -0
  40. community_streamflow_service-0.1.0/src/csfs/connectors/belgium_spw.py +64 -0
  41. community_streamflow_service-0.1.0/src/csfs/connectors/belgium_waterinfo.py +69 -0
  42. community_streamflow_service-0.1.0/src/csfs/connectors/bolivia_ine.py +616 -0
  43. community_streamflow_service-0.1.0/src/csfs/connectors/bosnia_fhmz.py +248 -0
  44. community_streamflow_service-0.1.0/src/csfs/connectors/brazil_ana.py +270 -0
  45. community_streamflow_service-0.1.0/src/csfs/connectors/bulgaria_eaemdr.py +206 -0
  46. community_streamflow_service-0.1.0/src/csfs/connectors/bulgaria_nimh.py +424 -0
  47. community_streamflow_service-0.1.0/src/csfs/connectors/ca_discharge.py +1585 -0
  48. community_streamflow_service-0.1.0/src/csfs/connectors/camels_dk.py +110 -0
  49. community_streamflow_service-0.1.0/src/csfs/connectors/camelsh.py +151 -0
  50. community_streamflow_service-0.1.0/src/csfs/connectors/caravan.py +1123 -0
  51. community_streamflow_service-0.1.0/src/csfs/connectors/chile_dga.py +253 -0
  52. community_streamflow_service-0.1.0/src/csfs/connectors/china_mwr.py +233 -0
  53. community_streamflow_service-0.1.0/src/csfs/connectors/colombia_ideam.py +265 -0
  54. community_streamflow_service-0.1.0/src/csfs/connectors/croatia_dhz.py +210 -0
  55. community_streamflow_service-0.1.0/src/csfs/connectors/czechia_chmu.py +210 -0
  56. community_streamflow_service-0.1.0/src/csfs/connectors/danube_his.py +489 -0
  57. community_streamflow_service-0.1.0/src/csfs/connectors/denmark_dmihyd.py +174 -0
  58. community_streamflow_service-0.1.0/src/csfs/connectors/ecuador_inamhi.py +505 -0
  59. community_streamflow_service-0.1.0/src/csfs/connectors/elsalvador_marn.py +426 -0
  60. community_streamflow_service-0.1.0/src/csfs/connectors/environment_canada.py +257 -0
  61. community_streamflow_service-0.1.0/src/csfs/connectors/estreams.py +118 -0
  62. community_streamflow_service-0.1.0/src/csfs/connectors/finland_syke.py +244 -0
  63. community_streamflow_service-0.1.0/src/csfs/connectors/france_hubeau.py +216 -0
  64. community_streamflow_service-0.1.0/src/csfs/connectors/geoglows.py +240 -0
  65. community_streamflow_service-0.1.0/src/csfs/connectors/germany_bavaria.py +223 -0
  66. community_streamflow_service-0.1.0/src/csfs/connectors/germany_bw.py +265 -0
  67. community_streamflow_service-0.1.0/src/csfs/connectors/germany_nrw.py +60 -0
  68. community_streamflow_service-0.1.0/src/csfs/connectors/germany_pegelonline.py +163 -0
  69. community_streamflow_service-0.1.0/src/csfs/connectors/glofas.py +221 -0
  70. community_streamflow_service-0.1.0/src/csfs/connectors/grdc.py +811 -0
  71. community_streamflow_service-0.1.0/src/csfs/connectors/greece_openhi.py +412 -0
  72. community_streamflow_service-0.1.0/src/csfs/connectors/gsim.py +595 -0
  73. community_streamflow_service-0.1.0/src/csfs/connectors/iceland_lamahice.py +408 -0
  74. community_streamflow_service-0.1.0/src/csfs/connectors/indonesia_pupr.py +183 -0
  75. community_streamflow_service-0.1.0/src/csfs/connectors/iran_iwrmc.py +434 -0
  76. community_streamflow_service-0.1.0/src/csfs/connectors/ireland_epa.py +282 -0
  77. community_streamflow_service-0.1.0/src/csfs/connectors/israel_caravan.py +407 -0
  78. community_streamflow_service-0.1.0/src/csfs/connectors/italy_emilia.py +248 -0
  79. community_streamflow_service-0.1.0/src/csfs/connectors/italy_ispra_wof.py +468 -0
  80. community_streamflow_service-0.1.0/src/csfs/connectors/italy_piedmont.py +246 -0
  81. community_streamflow_service-0.1.0/src/csfs/connectors/italy_tuscany.py +56 -0
  82. community_streamflow_service-0.1.0/src/csfs/connectors/jamaica_wra.py +348 -0
  83. community_streamflow_service-0.1.0/src/csfs/connectors/japan_mlit.py +391 -0
  84. community_streamflow_service-0.1.0/src/csfs/connectors/kazakhstan_kazhydromet.py +378 -0
  85. community_streamflow_service-0.1.0/src/csfs/connectors/lamah_ce.py +427 -0
  86. community_streamflow_service-0.1.0/src/csfs/connectors/lithuania_lhmt.py +250 -0
  87. community_streamflow_service-0.1.0/src/csfs/connectors/malaysia_did.py +608 -0
  88. community_streamflow_service-0.1.0/src/csfs/connectors/nepal_icimod.py +643 -0
  89. community_streamflow_service-0.1.0/src/csfs/connectors/netherlands_rws.py +276 -0
  90. community_streamflow_service-0.1.0/src/csfs/connectors/newzealand_hilltop.py +233 -0
  91. community_streamflow_service-0.1.0/src/csfs/connectors/norway_nve.py +232 -0
  92. community_streamflow_service-0.1.0/src/csfs/connectors/pakistan_wapda.py +646 -0
  93. community_streamflow_service-0.1.0/src/csfs/connectors/panama_stri.py +568 -0
  94. community_streamflow_service-0.1.0/src/csfs/connectors/peru_senamhi.py +112 -0
  95. community_streamflow_service-0.1.0/src/csfs/connectors/philippines_dpwh.py +430 -0
  96. community_streamflow_service-0.1.0/src/csfs/connectors/philippines_pagasa.py +94 -0
  97. community_streamflow_service-0.1.0/src/csfs/connectors/poland_imgw.py +157 -0
  98. community_streamflow_service-0.1.0/src/csfs/connectors/robin.py +114 -0
  99. community_streamflow_service-0.1.0/src/csfs/connectors/romania_inhga.py +104 -0
  100. community_streamflow_service-0.1.0/src/csfs/connectors/russia_arcticnet.py +497 -0
  101. community_streamflow_service-0.1.0/src/csfs/connectors/scotland_sepa.py +58 -0
  102. community_streamflow_service-0.1.0/src/csfs/connectors/sierem.py +746 -0
  103. community_streamflow_service-0.1.0/src/csfs/connectors/slovenia_arso.py +149 -0
  104. community_streamflow_service-0.1.0/src/csfs/connectors/south_africa_dws.py +484 -0
  105. community_streamflow_service-0.1.0/src/csfs/connectors/spain_cedex.py +743 -0
  106. community_streamflow_service-0.1.0/src/csfs/connectors/sweden_smhi.py +165 -0
  107. community_streamflow_service-0.1.0/src/csfs/connectors/switzerland_bafu.py +227 -0
  108. community_streamflow_service-0.1.0/src/csfs/connectors/taiwan_wra.py +184 -0
  109. community_streamflow_service-0.1.0/src/csfs/connectors/thailand_hii.py +242 -0
  110. community_streamflow_service-0.1.0/src/csfs/connectors/uk_ea.py +156 -0
  111. community_streamflow_service-0.1.0/src/csfs/connectors/uk_nrfa.py +185 -0
  112. community_streamflow_service-0.1.0/src/csfs/connectors/usgs.py +169 -0
  113. community_streamflow_service-0.1.0/src/csfs/connectors/vietnam_mekong.py +587 -0
  114. community_streamflow_service-0.1.0/src/csfs/connectors/wmo_whos.py +376 -0
  115. community_streamflow_service-0.1.0/src/csfs/core/__init__.py +3 -0
  116. community_streamflow_service-0.1.0/src/csfs/core/config.py +48 -0
  117. community_streamflow_service-0.1.0/src/csfs/core/downloads.py +349 -0
  118. community_streamflow_service-0.1.0/src/csfs/core/exceptions.py +31 -0
  119. community_streamflow_service-0.1.0/src/csfs/core/health.py +106 -0
  120. community_streamflow_service-0.1.0/src/csfs/core/models.py +77 -0
  121. community_streamflow_service-0.1.0/src/csfs/core/registry.py +44 -0
  122. community_streamflow_service-0.1.0/src/csfs/py.typed +0 -0
  123. community_streamflow_service-0.1.0/src/csfs/scheduler/__init__.py +0 -0
  124. community_streamflow_service-0.1.0/src/csfs/scheduler/cron.py +156 -0
  125. community_streamflow_service-0.1.0/src/csfs/scheduler/runner.py +201 -0
  126. community_streamflow_service-0.1.0/src/csfs/store/__init__.py +0 -0
  127. community_streamflow_service-0.1.0/src/csfs/store/base.py +84 -0
  128. community_streamflow_service-0.1.0/src/csfs/store/duckdb_store.py +344 -0
  129. community_streamflow_service-0.1.0/tests/__init__.py +0 -0
  130. community_streamflow_service-0.1.0/tests/conftest.py +77 -0
  131. community_streamflow_service-0.1.0/tests/connectors/__init__.py +0 -0
  132. community_streamflow_service-0.1.0/tests/connectors/test_adhi.py +741 -0
  133. community_streamflow_service-0.1.0/tests/connectors/test_afghanistan_usgs.py +293 -0
  134. community_streamflow_service-0.1.0/tests/connectors/test_argentina_snih.py +434 -0
  135. community_streamflow_service-0.1.0/tests/connectors/test_australia_bom.py +521 -0
  136. community_streamflow_service-0.1.0/tests/connectors/test_austria_ehyd.py +157 -0
  137. community_streamflow_service-0.1.0/tests/connectors/test_belgium_spw.py +179 -0
  138. community_streamflow_service-0.1.0/tests/connectors/test_belgium_waterinfo.py +557 -0
  139. community_streamflow_service-0.1.0/tests/connectors/test_bolivia_ine.py +665 -0
  140. community_streamflow_service-0.1.0/tests/connectors/test_bosnia_fhmz.py +249 -0
  141. community_streamflow_service-0.1.0/tests/connectors/test_brazil_ana.py +208 -0
  142. community_streamflow_service-0.1.0/tests/connectors/test_bulgaria_eaemdr.py +157 -0
  143. community_streamflow_service-0.1.0/tests/connectors/test_bulgaria_nimh.py +416 -0
  144. community_streamflow_service-0.1.0/tests/connectors/test_ca_discharge.py +376 -0
  145. community_streamflow_service-0.1.0/tests/connectors/test_camels_dk.py +131 -0
  146. community_streamflow_service-0.1.0/tests/connectors/test_camelsh.py +140 -0
  147. community_streamflow_service-0.1.0/tests/connectors/test_caravan.py +500 -0
  148. community_streamflow_service-0.1.0/tests/connectors/test_chile_dga.py +432 -0
  149. community_streamflow_service-0.1.0/tests/connectors/test_china_mwr.py +242 -0
  150. community_streamflow_service-0.1.0/tests/connectors/test_colombia_ideam.py +501 -0
  151. community_streamflow_service-0.1.0/tests/connectors/test_croatia_dhz.py +79 -0
  152. community_streamflow_service-0.1.0/tests/connectors/test_czechia_chmu.py +186 -0
  153. community_streamflow_service-0.1.0/tests/connectors/test_danube_his.py +600 -0
  154. community_streamflow_service-0.1.0/tests/connectors/test_denmark_dmihyd.py +98 -0
  155. community_streamflow_service-0.1.0/tests/connectors/test_ecuador_inamhi.py +539 -0
  156. community_streamflow_service-0.1.0/tests/connectors/test_elsalvador_marn.py +500 -0
  157. community_streamflow_service-0.1.0/tests/connectors/test_environment_canada.py +596 -0
  158. community_streamflow_service-0.1.0/tests/connectors/test_estreams.py +75 -0
  159. community_streamflow_service-0.1.0/tests/connectors/test_finland_syke.py +667 -0
  160. community_streamflow_service-0.1.0/tests/connectors/test_france_hubeau.py +176 -0
  161. community_streamflow_service-0.1.0/tests/connectors/test_geoglows.py +169 -0
  162. community_streamflow_service-0.1.0/tests/connectors/test_germany_bavaria.py +191 -0
  163. community_streamflow_service-0.1.0/tests/connectors/test_germany_bw.py +199 -0
  164. community_streamflow_service-0.1.0/tests/connectors/test_germany_nrw.py +40 -0
  165. community_streamflow_service-0.1.0/tests/connectors/test_germany_pegelonline.py +330 -0
  166. community_streamflow_service-0.1.0/tests/connectors/test_glofas.py +135 -0
  167. community_streamflow_service-0.1.0/tests/connectors/test_grdc.py +502 -0
  168. community_streamflow_service-0.1.0/tests/connectors/test_greece_openhi.py +414 -0
  169. community_streamflow_service-0.1.0/tests/connectors/test_gsim.py +529 -0
  170. community_streamflow_service-0.1.0/tests/connectors/test_iceland_lamahice.py +184 -0
  171. community_streamflow_service-0.1.0/tests/connectors/test_indonesia_pupr.py +177 -0
  172. community_streamflow_service-0.1.0/tests/connectors/test_iran_iwrmc.py +394 -0
  173. community_streamflow_service-0.1.0/tests/connectors/test_ireland_epa.py +134 -0
  174. community_streamflow_service-0.1.0/tests/connectors/test_israel_caravan.py +405 -0
  175. community_streamflow_service-0.1.0/tests/connectors/test_italy_emilia.py +162 -0
  176. community_streamflow_service-0.1.0/tests/connectors/test_italy_ispra_wof.py +178 -0
  177. community_streamflow_service-0.1.0/tests/connectors/test_italy_piedmont.py +250 -0
  178. community_streamflow_service-0.1.0/tests/connectors/test_italy_tuscany.py +40 -0
  179. community_streamflow_service-0.1.0/tests/connectors/test_jamaica_wra.py +394 -0
  180. community_streamflow_service-0.1.0/tests/connectors/test_japan_mlit.py +196 -0
  181. community_streamflow_service-0.1.0/tests/connectors/test_kazakhstan_kazhydromet.py +264 -0
  182. community_streamflow_service-0.1.0/tests/connectors/test_lamah_ce.py +413 -0
  183. community_streamflow_service-0.1.0/tests/connectors/test_lithuania_lhmt.py +432 -0
  184. community_streamflow_service-0.1.0/tests/connectors/test_malaysia_did.py +435 -0
  185. community_streamflow_service-0.1.0/tests/connectors/test_nepal_icimod.py +602 -0
  186. community_streamflow_service-0.1.0/tests/connectors/test_netherlands_rws.py +304 -0
  187. community_streamflow_service-0.1.0/tests/connectors/test_newzealand_hilltop.py +369 -0
  188. community_streamflow_service-0.1.0/tests/connectors/test_norway_nve.py +299 -0
  189. community_streamflow_service-0.1.0/tests/connectors/test_pakistan_wapda.py +503 -0
  190. community_streamflow_service-0.1.0/tests/connectors/test_panama_stri.py +431 -0
  191. community_streamflow_service-0.1.0/tests/connectors/test_peru_senamhi.py +97 -0
  192. community_streamflow_service-0.1.0/tests/connectors/test_philippines_dpwh.py +404 -0
  193. community_streamflow_service-0.1.0/tests/connectors/test_philippines_pagasa.py +52 -0
  194. community_streamflow_service-0.1.0/tests/connectors/test_poland_imgw.py +427 -0
  195. community_streamflow_service-0.1.0/tests/connectors/test_robin.py +131 -0
  196. community_streamflow_service-0.1.0/tests/connectors/test_romania_inhga.py +85 -0
  197. community_streamflow_service-0.1.0/tests/connectors/test_russia_arcticnet.py +493 -0
  198. community_streamflow_service-0.1.0/tests/connectors/test_scotland_sepa.py +167 -0
  199. community_streamflow_service-0.1.0/tests/connectors/test_sierem.py +383 -0
  200. community_streamflow_service-0.1.0/tests/connectors/test_slovenia_arso.py +67 -0
  201. community_streamflow_service-0.1.0/tests/connectors/test_south_africa_dws.py +565 -0
  202. community_streamflow_service-0.1.0/tests/connectors/test_spain_cedex.py +516 -0
  203. community_streamflow_service-0.1.0/tests/connectors/test_sweden_smhi.py +454 -0
  204. community_streamflow_service-0.1.0/tests/connectors/test_switzerland_bafu.py +553 -0
  205. community_streamflow_service-0.1.0/tests/connectors/test_taiwan_wra.py +124 -0
  206. community_streamflow_service-0.1.0/tests/connectors/test_thailand_hii.py +450 -0
  207. community_streamflow_service-0.1.0/tests/connectors/test_uk_ea.py +312 -0
  208. community_streamflow_service-0.1.0/tests/connectors/test_uk_nrfa.py +102 -0
  209. community_streamflow_service-0.1.0/tests/connectors/test_usgs.py +236 -0
  210. community_streamflow_service-0.1.0/tests/connectors/test_vietnam_mekong.py +631 -0
  211. community_streamflow_service-0.1.0/tests/connectors/test_wmo_whos.py +274 -0
  212. community_streamflow_service-0.1.0/tests/test_api.py +236 -0
  213. community_streamflow_service-0.1.0/tests/test_base_connector.py +293 -0
  214. community_streamflow_service-0.1.0/tests/test_cli.py +360 -0
  215. community_streamflow_service-0.1.0/tests/test_config.py +51 -0
  216. community_streamflow_service-0.1.0/tests/test_connector_integrity.py +186 -0
  217. community_streamflow_service-0.1.0/tests/test_cron.py +106 -0
  218. community_streamflow_service-0.1.0/tests/test_downloads.py +193 -0
  219. community_streamflow_service-0.1.0/tests/test_health.py +80 -0
  220. community_streamflow_service-0.1.0/tests/test_models.py +44 -0
  221. community_streamflow_service-0.1.0/tests/test_runner.py +291 -0
  222. community_streamflow_service-0.1.0/tests/test_store.py +247 -0
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a defect in CSFS
4
+ title: ""
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ **Describe the bug**
10
+
11
+ A clear and concise description of what went wrong.
12
+
13
+ **To reproduce**
14
+
15
+ ```bash
16
+ # Exact command(s) or minimal Python snippet
17
+ csfs fetch -p usgs --lookback 24
18
+ ```
19
+
20
+ **Expected behavior**
21
+
22
+ What you expected to happen.
23
+
24
+ **Actual behavior**
25
+
26
+ What actually happened. Include the full traceback or error output if there is one.
27
+
28
+ **Environment**
29
+
30
+ - CSFS version (`pip show csfs` or `csfs --version`):
31
+ - Python version:
32
+ - OS:
33
+ - Install method (PyPI / source):
34
+
35
+ **Provider-related?**
36
+
37
+ If the bug involves a specific connector, name the provider slug (e.g. `usgs`,
38
+ `france_hubeau`). Note that live-provider commands can fail because the
39
+ *upstream* agency API is down — please re-run once before filing, and say
40
+ whether the failure is reproducible.
41
+
42
+ **Additional context**
43
+
44
+ Anything else that helps (config file excerpt with secrets removed, database
45
+ size, scheduler tier, etc.).
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: Provider request
3
+ about: Propose a new streamflow agency, network, or dataset for CSFS
4
+ title: "Provider request: "
5
+ labels: provider, enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ **Provider**
10
+
11
+ - Agency / network / dataset name:
12
+ - Country or region covered:
13
+ - Website:
14
+
15
+ **Data access**
16
+
17
+ - API or download URL (if known):
18
+ - Access model: open / registration / API key / restricted / no API (scraping or manual download)
19
+ - Data format(s): JSON / CSV / WaterML / NetCDF / other
20
+ - Realtime, recent, or archive-only?
21
+ - Approximate number of discharge stations:
22
+ - License / terms of use (link if possible):
23
+
24
+ **Why it matters**
25
+
26
+ What gap does this provider fill (region, density, record length, realtime
27
+ latency)?
28
+
29
+ **Checklist for whoever implements it**
30
+
31
+ A new connector must satisfy the roster-integrity guards
32
+ (`tests/test_connector_integrity.py`):
33
+
34
+ - [ ] Connector module in `src/csfs/connectors/` registered with `@register("slug")`
35
+ - [ ] Entry in `inventory/providers.yaml` (only `status: implemented` once the connector is registered)
36
+ - [ ] Exactly one cron tier in `PROVIDER_TIERS` (`src/csfs/scheduler/cron.py`)
37
+ - [ ] Hermetic test in `tests/connectors/test_<slug>.py` (mocked HTTP; no live calls)
38
+
39
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md) for the full walkthrough.
@@ -0,0 +1,35 @@
1
+ ## Summary
2
+
3
+ What does this PR change, and why?
4
+
5
+ ## Type of change
6
+
7
+ - [ ] New provider connector
8
+ - [ ] Bug fix
9
+ - [ ] Core / store / scheduler change
10
+ - [ ] Documentation
11
+ - [ ] Other (describe)
12
+
13
+ ## Checklist
14
+
15
+ - [ ] `ruff check src/ tests/` passes
16
+ - [ ] `mypy src/csfs/` passes
17
+ - [ ] `pytest -m "not network"` passes (the suite is hermetic — no test may
18
+ reach a real upstream unless marked `@pytest.mark.network`)
19
+
20
+ ### For new connectors (roster-integrity guards)
21
+
22
+ `tests/test_connector_integrity.py` will fail CI unless all of these hold:
23
+
24
+ - [ ] Class metadata complete: `slug` (matches the registry key),
25
+ `display_name`, `base_url`, `country_codes`
26
+ - [ ] Slug added to **exactly one** tier in `PROVIDER_TIERS`
27
+ (`src/csfs/scheduler/cron.py`)
28
+ - [ ] Entry added to `inventory/providers.yaml` with an honest `status`
29
+ - [ ] Hermetic test `tests/connectors/test_<slug>.py` with mocked HTTP
30
+ (units normalized to m³/s, timestamps to UTC, error paths covered)
31
+
32
+ ## Notes for the reviewer
33
+
34
+ Anything that needs special attention (upstream quirks, rate limits,
35
+ licensing of the source data, etc.).
@@ -0,0 +1,144 @@
1
+ name: Acquire
2
+
3
+ # Scheduled streamflow acquisition on GitHub Actions.
4
+ #
5
+ # The canonical DuckDB store is kept as an asset on a single "db-snapshot"
6
+ # GitHub Release. Each run downloads it, fetches one tier, re-uploads it, then
7
+ # checks health for that tier and alerts (via a GitHub issue) on failure.
8
+ #
9
+ # NOTE: only the daily and weekly tiers run on schedule here. The realtime
10
+ # (15-min) and hourly tiers would re-upload the ~700 MB DB dozens of times a
11
+ # day — impractical on Actions; run those on a long-lived host instead. You can
12
+ # still trigger any tier manually via "Run workflow".
13
+
14
+ on:
15
+ schedule:
16
+ - cron: "30 2 * * *" # daily 02:30 UTC
17
+ - cron: "0 3 * * 0" # weekly Sun 03:00 UTC
18
+ workflow_dispatch:
19
+ inputs:
20
+ tier:
21
+ description: "Tier to fetch"
22
+ type: choice
23
+ default: daily
24
+ options: [realtime, hourly, daily, weekly]
25
+
26
+ # One acquisition at a time — concurrent runs would race the shared DB asset.
27
+ concurrency:
28
+ group: csfs-acquire
29
+ cancel-in-progress: false
30
+
31
+ permissions:
32
+ contents: write # upload the DB asset to the release
33
+ issues: write # open/update the health-alert issue
34
+
35
+ env:
36
+ DB_TAG: db-snapshot
37
+ DB_FILE: csfs.duckdb
38
+
39
+ jobs:
40
+ acquire:
41
+ runs-on: ubuntu-latest
42
+ timeout-minutes: 120
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - uses: actions/setup-python@v5
47
+ with:
48
+ python-version: "3.12"
49
+
50
+ - name: Install
51
+ run: pip install -e ".[api]"
52
+
53
+ - name: Select tier
54
+ id: tier
55
+ run: |
56
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
57
+ echo "tier=${{ inputs.tier }}" >> "$GITHUB_OUTPUT"
58
+ elif [ "${{ github.event.schedule }}" = "0 3 * * 0" ]; then
59
+ echo "tier=weekly" >> "$GITHUB_OUTPUT"
60
+ else
61
+ echo "tier=daily" >> "$GITHUB_OUTPUT"
62
+ fi
63
+
64
+ - name: Restore DB snapshot
65
+ env:
66
+ GH_TOKEN: ${{ github.token }}
67
+ run: |
68
+ if gh release download "$DB_TAG" --pattern "$DB_FILE" --clobber 2>/dev/null; then
69
+ echo "Restored $DB_FILE ($(du -h "$DB_FILE" | cut -f1))"
70
+ else
71
+ echo "No existing snapshot — starting a fresh DB."
72
+ fi
73
+
74
+ - name: Fetch tier ${{ steps.tier.outputs.tier }}
75
+ # Bound each cycle: some connectors have thousands of stations (e.g.
76
+ # Brazil ANA ~17.6k), and an unbounded run iterates them all every time,
77
+ # taking far too long. MAX_STATIONS caps stations per connector per
78
+ # cycle. (Today the runner takes the first N; rotating coverage across
79
+ # runs is a future improvement.)
80
+ env:
81
+ MAX_STATIONS: "500"
82
+ CONCURRENCY: "12"
83
+ run: |
84
+ csfs fetch --tier "${{ steps.tier.outputs.tier }}" \
85
+ --max-stations "$MAX_STATIONS" --concurrency "$CONCURRENCY"
86
+
87
+ - name: Save DB snapshot
88
+ env:
89
+ GH_TOKEN: ${{ github.token }}
90
+ run: |
91
+ gh release view "$DB_TAG" >/dev/null 2>&1 \
92
+ || gh release create "$DB_TAG" --title "DB snapshot" \
93
+ --notes "Rolling canonical CSFS DuckDB store (updated by Acquire)."
94
+ gh release upload "$DB_TAG" "$DB_FILE" --clobber
95
+
96
+ - name: Health report
97
+ id: health
98
+ run: |
99
+ csfs health --tier "${{ steps.tier.outputs.tier }}" | tee health.txt
100
+ csfs health --tier "${{ steps.tier.outputs.tier }}" --json > health.json
101
+ # Alert only on acquisition runs that errored/degraded this cycle.
102
+ if csfs health --tier "${{ steps.tier.outputs.tier }}" \
103
+ --degraded-only --fail-on error,degraded; then
104
+ echo "degraded=false" >> "$GITHUB_OUTPUT"
105
+ else
106
+ echo "degraded=true" >> "$GITHUB_OUTPUT"
107
+ fi
108
+
109
+ - name: Upload health artifact
110
+ uses: actions/upload-artifact@v4
111
+ with:
112
+ name: health-${{ steps.tier.outputs.tier }}
113
+ path: |
114
+ health.txt
115
+ health.json
116
+
117
+ - name: Alert on degraded connectors
118
+ if: steps.health.outputs.degraded == 'true'
119
+ env:
120
+ GH_TOKEN: ${{ github.token }}
121
+ TIER: ${{ steps.tier.outputs.tier }}
122
+ run: |
123
+ title="CSFS health alert: ${TIER} tier"
124
+ body="One or more connectors in the **${TIER}** tier errored or degraded in the latest run ($(date -u +%Y-%m-%dT%H:%MZ)).
125
+
126
+ \`\`\`
127
+ $(cat health.txt)
128
+ \`\`\`
129
+
130
+ Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
131
+ existing=$(gh issue list --state open --search "$title in:title" --json number --jq '.[0].number')
132
+ if [ -n "$existing" ]; then
133
+ gh issue comment "$existing" --body "$body"
134
+ else
135
+ gh issue create --title "$title" --label "health" --body "$body" \
136
+ || gh issue create --title "$title" --body "$body"
137
+ fi
138
+
139
+ # The job is NOT failed when connectors degrade: in a real tier some
140
+ # connector is almost always degraded (dead host, awaiting data, etc.), so
141
+ # failing here would make every run red and train people to ignore it.
142
+ # A successful acquisition that saved the snapshot is a success; degraded
143
+ # connectors are surfaced via the alert issue and the health artifact.
144
+ # The job still fails naturally if fetch or the snapshot upload errors.
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: pip install -e ".[dev,api]"
26
+
27
+ - name: Lint
28
+ run: ruff check src/ tests/
29
+
30
+ - name: Type check
31
+ run: mypy src/csfs/
32
+
33
+ - name: Test
34
+ # Tests are hermetic: tests/conftest.py blocks real network access, so
35
+ # connectors must mock their HTTP. `-m "not network"` skips any test
36
+ # explicitly opted into reaching a real upstream.
37
+ run: pytest tests/ -v --tb=short -m "not network"
@@ -0,0 +1,47 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "mkdocs.yml"
9
+ - "src/csfs/**"
10
+ - ".github/workflows/docs.yml"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow one concurrent deployment; don't cancel an in-progress run.
19
+ concurrency:
20
+ group: pages
21
+ cancel-in-progress: false
22
+
23
+ jobs:
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-python@v5
29
+ with:
30
+ python-version: "3.12"
31
+ - name: Install docs dependencies
32
+ run: pip install -e ".[docs]"
33
+ - name: Build site
34
+ run: mkdocs build --strict
35
+ - uses: actions/upload-pages-artifact@v3
36
+ with:
37
+ path: site
38
+
39
+ deploy:
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ environment:
43
+ name: github-pages
44
+ url: ${{ steps.deployment.outputs.page_url }}
45
+ steps:
46
+ - id: deployment
47
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,42 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+
8
+ *.duckdb
9
+ *.duckdb.wal
10
+ *.parquet
11
+ data/datasets/
12
+
13
+ # Local data artifacts (station dumps, maps, outreach notes) kept out of git
14
+ data/all_stations.json
15
+ data/all_stations_full.json
16
+ data/coverage_stats.json
17
+ data/provider_summary.json
18
+ data/station_map.html
19
+ data/data_request_emails.md
20
+
21
+ .env
22
+ .env.*
23
+ *.secret
24
+
25
+ .venv/
26
+ venv/
27
+
28
+ # mkdocs build output
29
+ site/
30
+
31
+ .pytest_cache/
32
+ .mypy_cache/
33
+ .ruff_cache/
34
+ .coverage
35
+ htmlcov/
36
+
37
+ *.DS_Store
38
+ .idea/
39
+ .vscode/
40
+ *.swp
41
+
42
+ .claude/
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] — 2026-06-11
9
+
10
+ Initial release.
11
+
12
+ ### Added
13
+
14
+ - 86 provider connectors covering live agency APIs (USGS NWIS, UK EA,
15
+ Hub'Eau, Environment Canada, PEGELONLINE, and many more), offline archive
16
+ datasets (GRDC, Caravan, GSIM, EStreams, LamaH, CAMELS variants), and
17
+ model/aggregator sources (GloFAS, GEOGLOWS, WMO WHOS views).
18
+ - Canonical `Station` / `Observation` / `TimeSeriesChunk` data model
19
+ (pydantic) with discharge normalized to m³/s and UTC timestamps.
20
+ - DuckDB persistence layer (`DuckDBStore`) with station upserts,
21
+ observation appends, acquisition history, and connector-health queries.
22
+ - Scheduler with four cron tiers (realtime / hourly / daily / weekly),
23
+ per-tier lookback windows, and a long-lived daemon mode.
24
+ - `csfs` CLI: `fetch`, `daemon`, `providers`, `stations`, `status`,
25
+ `health`, `download-data`, `serve`.
26
+ - FastAPI read layer for querying stations and observations over HTTP.
27
+ - Global provider inventory (`inventory/providers.yaml`): 104 cataloged
28
+ sources labeled by readiness status (implemented / research / fallback /
29
+ manual).
30
+ - Roster-integrity guard tests: every registered connector must have test
31
+ coverage, belong to exactly one cron tier, and be documented in the
32
+ inventory; `status: implemented` entries must have a registered connector.
33
+ - Hermetic test suite: an autouse DNS guard blocks real network access;
34
+ live tests opt in via `@pytest.mark.network`.
35
+ - Scheduled acquisition workflow on GitHub Actions with a release-hosted
36
+ DuckDB snapshot and health alerting.
37
+
38
+ [0.1.0]: https://github.com/DarriEy/CSFS/releases/tag/v0.1.0
@@ -0,0 +1,26 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ title: "CSFS: Community Streamflow Service"
4
+ type: software
5
+ authors:
6
+ - family-names: Eythorsson
7
+ given-names: Darri
8
+ email: dae5@hi.is
9
+ orcid: "https://orcid.org/0000-0003-3653-3936"
10
+ affiliation: "University of Calgary"
11
+ repository-code: "https://github.com/DarriEy/CSFS"
12
+ license: GPL-3.0-or-later
13
+ version: 0.1.0
14
+ date-released: 2026-06-11
15
+ keywords:
16
+ - hydrology
17
+ - streamflow
18
+ - discharge
19
+ - open-data
20
+ - time-series
21
+ abstract: >-
22
+ CSFS is a live acquisition service that connects to streamflow data
23
+ providers worldwide, harmonizes their observations into a canonical
24
+ station/observation schema, and maintains a near-real-time DuckDB
25
+ store with scheduler tiers, health monitoring, a CLI, and a FastAPI
26
+ read layer.
@@ -0,0 +1,85 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
7
+
8
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
9
+
10
+ ## Our Standards
11
+
12
+ Examples of behavior that contributes to a positive environment for our community include:
13
+
14
+ * Demonstrating empathy and kindness toward other people
15
+ * Being respectful of differing opinions, viewpoints, and experiences
16
+ * Giving and gracefully accepting constructive feedback
17
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18
+ * Focusing on what is best not just for us as individuals, but for the overall community
19
+
20
+ Examples of unacceptable behavior include:
21
+
22
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
26
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
27
+
28
+ ## Enforcement Responsibilities
29
+
30
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
31
+
32
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
33
+
34
+ ## Scope
35
+
36
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
37
+
38
+ ## Enforcement
39
+
40
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at dae5@hi.is. All complaints will be reviewed and investigated promptly and fairly.
41
+
42
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
43
+
44
+ ## Enforcement Guidelines
45
+
46
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
47
+
48
+ ### 1. Correction
49
+
50
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
51
+
52
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
53
+
54
+ ### 2. Warning
55
+
56
+ **Community Impact**: A violation through a single incident or series of actions.
57
+
58
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
59
+
60
+ ### 3. Temporary Ban
61
+
62
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
63
+
64
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
65
+
66
+ ### 4. Permanent Ban
67
+
68
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
69
+
70
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
71
+
72
+ ## Attribution
73
+
74
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
75
+
76
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
77
+
78
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
79
+
80
+ [homepage]: https://www.contributor-covenant.org
81
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
82
+ [Mozilla CoC]: https://github.com/mozilla/diversity
83
+ [FAQ]: https://www.contributor-covenant.org/faq
84
+ [translations]: https://www.contributor-covenant.org/translations
85
+
@@ -0,0 +1,92 @@
1
+ # Contributing to CSFS
2
+
3
+ Thank you for considering a contribution! The most valuable contribution to
4
+ CSFS is a new provider connector — there are dozens of national and regional
5
+ hydrological agencies whose data is still out of reach.
6
+
7
+ ## Development setup
8
+
9
+ ```bash
10
+ git clone https://github.com/DarriEy/CSFS.git
11
+ cd CSFS
12
+ python -m venv .venv && source .venv/bin/activate
13
+ pip install -e ".[dev,api]"
14
+ ```
15
+
16
+ Run the checks the CI runs:
17
+
18
+ ```bash
19
+ ruff check src/ tests/
20
+ mypy src/csfs/
21
+ pytest -m "not network"
22
+ ```
23
+
24
+ ## Hermetic test policy
25
+
26
+ The test suite must pass **offline**. An autouse fixture in
27
+ `tests/conftest.py` blocks DNS resolution for any non-local host, so an
28
+ unmocked HTTP call fails fast instead of hanging. Consequences:
29
+
30
+ - Connector tests must mock their HTTP with [respx](https://lundberg.github.io/respx/)
31
+ (or equivalent) — never hit the real upstream.
32
+ - A test that intentionally reaches a real API must be marked
33
+ `@pytest.mark.network`. CI deselects these via `-m "not network"`.
34
+
35
+ ## Adding a connector
36
+
37
+ 1. Create `src/csfs/connectors/your_provider.py`.
38
+ 2. Subclass `BaseConnector` and implement `fetch_stations()` and
39
+ `fetch_observations()`. Normalize discharge to **m³/s** and timestamps to
40
+ **UTC**; set the class metadata (`slug`, `display_name`, `base_url`,
41
+ `country_codes`).
42
+ 3. Decorate the class with `@register("your_slug")` — the slug must equal the
43
+ class's `slug` attribute.
44
+ 4. Add a provider entry to `inventory/providers.yaml` with
45
+ `status: implemented`.
46
+ 5. Add the slug to exactly one cron tier in
47
+ `src/csfs/scheduler/cron.py` (`PROVIDER_TIERS`): `realtime`, `hourly`,
48
+ `daily`, or `weekly`, matching the provider's update cadence.
49
+ 6. Write `tests/connectors/test_your_slug.py` with mocked HTTP covering
50
+ station discovery and observation parsing (units, timestamps, quality
51
+ flags, error paths).
52
+
53
+ ## Roster-integrity requirements
54
+
55
+ `tests/test_connector_integrity.py` mechanically enforces the roster's
56
+ honesty. Your PR will fail CI unless **all** of the following hold:
57
+
58
+ - **Test coverage is mandatory.** Every registered connector must either have
59
+ its own `tests/connectors/test_<slug>.py` or be referenced by slug inside an
60
+ existing connector test (for variant/subclass connectors exercised by a
61
+ shared parent test).
62
+ - **Exactly one cron tier.** Every registered slug must appear in exactly one
63
+ tier of `PROVIDER_TIERS` — an orphaned connector would never be acquired; a
64
+ duplicated one would be acquired twice.
65
+ - **No ghost tiers.** Every slug listed in a tier must correspond to a
66
+ registered connector (catches typos and deleted connectors).
67
+ - **Complete metadata.** Each connector class must expose a `slug` matching
68
+ its registry key, a non-empty `display_name`, a non-empty `base_url`, and a
69
+ `country_codes` list of ISO 3166-1 alpha-2 codes (or the `"global"`
70
+ sentinel for global datasets).
71
+ - **Documented in the inventory.** Every registered connector needs an entry
72
+ in `inventory/providers.yaml`.
73
+ - **No overclaiming.** An inventory entry may only carry
74
+ `status: implemented` if its slug is actually registered. Anything
75
+ documented but not built must be labeled `planned`, `research`, `manual`,
76
+ or `fallback`.
77
+ - **Valid committed config.** Provider keys in the repo-root `csfs.yaml` must
78
+ reference registered connectors.
79
+
80
+ ## Style
81
+
82
+ - `ruff` (lint + import order) and `mypy` must pass; both run in CI.
83
+ - Line length 120; target Python 3.11+.
84
+ - Start new source files with the SPDX header used across the codebase.
85
+
86
+ ## Reporting issues
87
+
88
+ Use the issue templates: **Bug report** for defects, **Provider request** to
89
+ propose a new streamflow agency or network.
90
+
91
+ By contributing you agree that your contributions are licensed under
92
+ GPL-3.0-or-later.