MS MVC Scheduling Web Application

A web application for scheduling patient appointments at a clinic


First the Architecture:


MVC, ORM Entity Framework:

There is nothing special here, this is what a monolith looks like built on top of a Microsoft stack. Well, except maybe the Audit Log built on top of the Database layer. The web application is a collection of static files (scripts, css files, images) Views, UI Logic classes, ORM classes and settings.

SQL Server:

The database layer is a SQL Server version that allows for triggers. You probably already understand where the audit logs are coming from by now. If you do, go ahead and scroll down to the next section.

If you are still reading; We created tables and AuditLog versions of the tables at schema design time. So the database contains both versions of the table. The AuditLog version of the table schema contains couple extra fields, like UserName, LastUpdatedDate etc. Then we created triggers of every table to write the previous version of the data record into its AuditLog table. Note: the AuditLog tables will contain (N * 1) number of records, where N is the number of changes to the record, and the actual table containing the current record. Here is an example:

User Table: Contains 20 records
AuditLog_User Table: Contains 0 records.
This happens when no changes have been made to the 20 records in the User table.
User Table: Contains 20 records
AuditLog_User Table: Contains 1 record.
This happens when 1 of the 20 records in the User Table has been updated to contain different information.

At this point the User Table will contain User name for the person who created the original record and the AuditLog record would contain, who created the original record and who updated it.

The Sequence of Events:

The Web Application writes data to the Persistent Database via the ORM attached to the Web Application. The Database (SQL Server web edition) executes a trigger that takes the existing data from the current table and sends it to the AuditLog Table for auditing purposes. If the Audit record is successfully committed, the actual record is then written to the proper table.

Microservices:

Step 1, to strangle this application would be to break down the functionality into services of their own. Depending on the type of functionality required, we would break them down into services. Some of the examples would be Procedure, Search, Config, Notification, Request, Scheduler etc.

CQRS Architecture:

Question is, do we need it? The Answer in this case is, yes we do! The Clinics and Hospitals using this software would want other events to be triggered off of commands executed on this software.

Command Mechanism:

The diagram is self explanatory.

Query Mechanism:

The diagram is self explanatory.