|
5 | 5 |
|
6 | 6 | from sbsearch.target import FixedTarget |
7 | 7 | from .catch import Catch, IntersectionType # noqa: F401 |
| 8 | +from . import stats |
8 | 9 | from .config import Config # noqa: F401 |
9 | 10 |
|
10 | 11 |
|
@@ -44,6 +45,16 @@ def catch_cli(*args): |
44 | 45 | ) |
45 | 46 | status_sources.set_defaults(command="status/sources") |
46 | 47 |
|
| 48 | + status_updates = subparsers.add_parser( |
| 49 | + "status/updates", help="summarize recent updates to the database" |
| 50 | + ) |
| 51 | + status_updates.set_defaults(command="status/updates") |
| 52 | + |
| 53 | + status_queries = subparsers.add_parser( |
| 54 | + "status/queries", help="summarize recent queries" |
| 55 | + ) |
| 56 | + status_queries.set_defaults(command="status/queries") |
| 57 | + |
47 | 58 | list_sources = subparsers.add_parser("sources", help="show available data sources") |
48 | 59 | list_sources.set_defaults(command="sources") |
49 | 60 |
|
@@ -138,9 +149,21 @@ def catch_cli(*args): |
138 | 149 | elif args.command == "status/sources": |
139 | 150 | if args.update: |
140 | 151 | print("Updating survey statistics.") |
141 | | - catch.update_statistics() |
142 | | - tab = Table(catch.source_statistics()) |
| 152 | + stats.update_statistics(catch) |
| 153 | + tab = Table(stats.source_statistics(catch)) |
143 | 154 | tab.pprint_all() |
| 155 | + elif args.command == "status/updates": |
| 156 | + tab = Table(stats.recently_added_observations(catch)) |
| 157 | + if len(tab) == 0: |
| 158 | + print("# No data") |
| 159 | + else: |
| 160 | + tab.pprint_all() |
| 161 | + elif args.command == "status/queries": |
| 162 | + tab = Table(stats.recent_queries(catch)) |
| 163 | + if len(tab) == 0: |
| 164 | + print("# No data") |
| 165 | + else: |
| 166 | + tab.pprint_all() |
144 | 167 | elif args.command == "moving": |
145 | 168 | catch.start_date = args.start_date |
146 | 169 | catch.stop_date = args.stop_date |
@@ -314,6 +337,8 @@ def _serialize_object(data_object): |
314 | 337 | "metadata", |
315 | 338 | "cutout_url", |
316 | 339 | "preview_url", |
| 340 | + "diff_cutout_url", |
| 341 | + "diff_preview_url", |
317 | 342 | "set_fov", |
318 | 343 | "registry", |
319 | 344 | "test_edges", |
|
0 commit comments