Skip to content

Commit 66d1d40

Browse files
committed
Merge branch 'main' of github.com:Small-Bodies-Node/catch
2 parents d75e367 + 8fef5ad commit 66d1d40

19 files changed

+432
-2198
lines changed

catch/__init__.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from sbsearch.target import FixedTarget
77
from .catch import Catch, IntersectionType # noqa: F401
8+
from . import stats
89
from .config import Config # noqa: F401
910

1011

@@ -44,6 +45,16 @@ def catch_cli(*args):
4445
)
4546
status_sources.set_defaults(command="status/sources")
4647

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+
4758
list_sources = subparsers.add_parser("sources", help="show available data sources")
4859
list_sources.set_defaults(command="sources")
4960

@@ -138,9 +149,21 @@ def catch_cli(*args):
138149
elif args.command == "status/sources":
139150
if args.update:
140151
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))
143154
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()
144167
elif args.command == "moving":
145168
catch.start_date = args.start_date
146169
catch.stop_date = args.stop_date
@@ -314,6 +337,8 @@ def _serialize_object(data_object):
314337
"metadata",
315338
"cutout_url",
316339
"preview_url",
340+
"diff_cutout_url",
341+
"diff_preview_url",
317342
"set_fov",
318343
"registry",
319344
"test_edges",

0 commit comments

Comments
 (0)