department-of-veterans-affairs / abd-vro

To get Veterans benefits in minutes, VRO software uses health evidence data to help fast track disability claims.
Other
19 stars 6 forks source link

VRO 1.0 Database design #114

Open yoomlam opened 2 years ago

yoomlam commented 2 years ago

Issue to discuss DB entities for VRO 1.0.

Below are DB tables (representing relevant entities) and their DB columns.

Claim

Veteran

Expecting only 1 veteran per claim

Contention

A claim can have multiple contentions

AssessmentResult

A new record is created each time the assess_claim endpoint is called and a non-error response returned.

EvidenceSummaryDocument

A new record is created each time the generate_summary_doc endpoint is called and a non-error response returned.

dimitri-amida commented 2 years ago

Requirements questions:

Technical questions:

yoomlam commented 2 years ago

Requirements questions:

  • Is cliam_uuid redundant in "AssessmentResukt" and "EvidenceSummaryDocument"? It already has a contention_uuid and the Contention is linked to claim.

It is. Here's my reasoning but feel free to remove claim_uuid: Since a Claim is a primary entity being passed around at the VA, may things are associated with a Claim rather than a Contention. I included claim_uuid for faster query performance, i.e., if VRO ever wants to query all AssessmentResult records associated with a Claim. This may be pre-optimizing, so you can remove it and we can always add it later if needed.

  • Does the claim, when it reaches the service, already contain assessments and evidence, or are these added later on?

Great question! Somewhat complex answer:

  • If a claim arrives for a veteran that's already in the DB, I assume we attach the claim to the existing record

Yes! Veterans can and often submit multiple claims.

Technical questions:

  • what schema do we use? Same as the rest of the app, or a schema specific to this module?

Not sure I understand where you're coming from. I was expecting a single schema be used for all of VRO. I'm not familiar with "a schema specific to this module" and what that implies.

  • How is this module called from services?
  • What is the format of the input to this module?
  • Does this module need to provide an API for accessing the data? If so, is it REST?

To be discussed and decided by the microservices developers, who will be reading and writing to the DB.

yoomlam commented 2 years ago

I'd like to present another option for the team's consideration. Instead of a REST interface to the DB (may be more overhead than needed since only VRO will be accessing the DB) or a language-specific DB driver (we'd have to maintain a DB driver for each language that a microservice is written in), we can leverage Apache Camel (such as Camel's JDBC component) if certain constraints are satisfied, for example if microservices don't need to read/write to the DB except at the beginning (input) or end (output) of their processing. An advantage of this option is that microservices don't need to directly access the DB, and hence less coupling, which is good when/if we change DB implementation.

If desired, we can discuss more about this option at our meeting with microservices developers.

dimitri-amida commented 2 years ago

Here are some additional thoughts

yoomlam commented 2 years ago
  • If we want to maintain a history of updates to every claim, then the current database design is insufficient, since it only shows the latest version. The "last updated date" may tell us that there have been updates, but we may not be able to tell what they were.

Agree! Auditing is not required for VRO 1.0, but it will be useful for reporting as described in the Roadmap wiki page:

claim_stats_Endpoint (low priority): Add claim_stats endpoint to API for reporting and monitoring

Maybe have a separate table called something like ClaimEvents with an event_type field (with possible values "new_claim", "new_contention", "contention_updated", etc.). A new record is created when the assess_claim endpoint is called, so I expect this table will become large, which is okay since it will only be for diagnostics and reporting.

  • Should we save some identifier of the service calling save-to-db in order to be able to tell where it came from?

If I'm interpreting this properly, I'm not sure we need that level of granularity stored in the DB. Couldn't we get this from regular logs, i.e. the save-to-db logs would occur immediately after the service logs?

yoomlam commented 2 years ago

We've decided to move forward with using Camel to add a step to read from (and possibly write to if the record doesn't already exist) the DB to inject data into the input of a contention processor (e.g., hypertension processor). This will decouple the processor microservice from having to interact with the DB. The output of the microservice will include some JSON fields that will result in writing some record (e.g., AssessmentResult) to the DB, so there will be a new workflow step after each processor to write to the DB. I expect adding these new DB interaction steps will occur in the routes defined in ClaimProcessorRoute and PrimaryRoutes.