Get a total count of a smart contract template over a period

Hello,

I am building an ODS to keep a set of the smart contract for a faster query performance. To detect bugs / to check integrity, I’d like to have a reconciliation of the total count of each smart contract template for a certain period (maybe past 24hours) against the my ODS.
Is there any API call on Canton may help to get the count per template for a certain period? Streaming / subscription of smart contract creation one by one is not efficient. Moreover, the ODS is built with this mechanism. Using the same mechanism in the reconciliation may hide the bugs.

Thanks in advance for any insight.

There isn’t anything built in for that unfortunately. Assuming your only interested in active contracts you could query the active contract service at the offset your ODS has caught up to for a given template and count the number of contratcs in the result. That’s sufficiently simply that I wouldn’t worry much about hiding bugs that way.