With the release of the CDMResults service in the WebAPI a new issue has emerged.
You will see issues with a loading indicator in the public version of Hermes. The underlying cause of this issue is that Hermes is trying to look up Achilles results for a concept when you view it. The database that the public WebAPI is configured to connect to does not have an achilles_results table. A SqlException is thrown, not caught, and the WebAPI returns a 404, which in turn leads to the ajax call from the client never hitting a ‘success’ block and the client fails to update properly.
The broader discussion here is: how do we ensure that tables that are required by the WebAPI are available before we attempt to use them?
My thoughts on solutions:
-
If a table does not exist it is created by the WebAPI. This requires that the credentials used by the WebAPI have permissions to create tables in the databases and that the DDL for all tables is included as resources to the WebAPI.
-
Simply catch the exception that occurs and return an empty object, MonthlyPrevalence in this case, allowing the client to continue on as if no data were found without knowledge that the table does not exist.
-
A StatusService is programmed to check on the availability of required tables and return a status object describing the current state of the tables required by WebAPI. Clients can use this StatusService to ensure the required tables are available before attempt to call features that might not be supported.
-
AbstractDaoService is modified to include a static array of strings which identify tables it depends on for proper function. Each implementation of an AbstractDaoService overrides the array to contain the proper set of tables for its purpose. A StatusService uses reflection to identify all classes that extend AbstractDaoService and check for the existence of those tables. Clients can use this StatusService to ensure the required tables are available before attempt to call features that might not be supported.
I’m interested in hearing everyone’s opinion on these solutions but also other recommended solutions.