Health-Informatics-UoN / carrot-mapper

Convenient and Reusable Rapid Omop Transformer.
https://carrot.ac.uk
MIT License
14 stars 4 forks source link

Scan Report Fields/Values Concepts server side #866

Open AndyRae opened 2 months ago

AndyRae commented 2 months ago

Currently viewing the Scan Report fields / values along with their Scan Report Concepts happens on the "frontend" Next client.

For example to display the values page UI, it runs as:

  1. Fetches the Scan Report Values by API
  2. Fetches the Scan Report Concepts based on the values ID's by API
  3. Combined them into an object.
  4. Renders in a table.

This is annoying for a few reasons:

  1. Multiple database queries, and serialisation to API
  2. Prevents any filtering / sorting model on the Scan Report Concepts.
  3. Combining on the client can be slow.

Instead I propose moving this functionality completely to the backend API. A new endpoint named ?? will list the combined Scan Report Values + Concepts in nested objects.

By moving to the backend, it will:

  1. Enable filtering/sorting on the Concept level.
  2. Possibly make this page faster, but this depends on how the database queries are able to be produced.
    • Fetching all Values/Concepts in one query might be cleaner and easier to enable filter/sort.
    • But it is possible that duplicate Concepts are being fetched / serialised, and we are losing this optimisation.