Web Application
A Java-based web application which provides a CRUD REST API for compounds and their associated assay results. It is backed by an in-memory relational database.
Database
The database schema is generated by the ORM framework (JPA/Hibernate) via annotations in the Java code. The database tables are automatically populated from a SQL population script (src/main/resources/data.sql). Both of the above happen each time the web application starts up. As a consequence, any changes are not persisted between invocations of the web application.
Python (SQL generation) Script
The SQL population script is generated from the provided data/compounds.json and data/schema.json files using a Python script (scripts/json2sql.py). As of this writing, this is done manually, prior to building the application. Note: A pre-generated SQL population script is provided for ease of deployment.
See the Usage section below for build and run instructions.
- Dockerisation (we use Docker™ containers to build and run the web application)
- Integration tests (to test the API's web-service endpoints)
- Swagger (provides a web-based interface to the API for testing and comprehension)
- Pageable (optional endpoint with paging metadata provided for Compound collections)
Working from the root directory of the project, instructions are as follows:
-
Execute the build script (this may take a few minutes the first time you run it)
-
Execute the run script to start the web application
./scripts/build.sh ./scripts/run.sh
You can exercise the web-service endpoints by navigating your browser to: http://localhost:8080/swagger-ui/
Alternatively, you can use the supplied "collection" file (./postman_collection.json) in Postman™ to try it out from there.
- Data validation on POST and PUT operations
- Implement filtering and ordering features
- Make the API more "hypermedia-driven" by following HATEOAS principles in the API design
- Improve automation by moving database script generation into the Docker™ configuration
- One or two of the (ORM) auto-generated SQL queries are inefficient and should be optimised
- The integration tests are nowhere near complete but hopefully demonstrate the general approach
- The Python script (json2sql.py) is obscenely hard-coded and non-intuitive but served its purpose at the time
- The Swagger API documentation could be prettier and more helpful