Backend Dev: Implementation Plan

2 min read

🛠️ Backend Dev: Decision for 001 & 002

This document summarizes the technical decision and implementation plan based on the previous proposals:


1. Suggestion 001: Test Definition Architecture

Action: DEFERRED

  • We will skip the architectural overhaul of the testdef module for now.
  • Current table structure remains unchanged to maintain stability.

2. Suggestion 002: Valueset Implementation

Action: ADOPTED (Code-First Migration)

We are moving forward with moving system constants from the database into the codebase, but with a focus on existing API compatibility.

Technical Requirements:

  • Maintain Endpoint integrity: The API endpoint must remain functional without changes to the frontend.
  • Data Migration: Move values (Gender, Status, etc.) from the valueset table into a centralized PHP constant or config file named Valuesets.php.
  • Controller Refactor: Update the backend controller to serve the JSON response from the file rather than a database query.

3. Translation Logic (Getting labels like "Female" from "F")

When pulling data from the database, you can translate raw keys into readable labels instantly using the new class.

Example PHP Usage:

// Direct mapping in your controller or view
$genderLabel = Valuesets::GENDER[$patient->gender] ?? 'Unknown';

// Or use a helper method in the Valuesets class
public static function getLabel($category, $key) {
    return self::{$category}[$key] ?? $key;
}

4. Implementation Steps

  1. Create Valuesets.php in the backend libraries folder.
  2. Refactor Valueset controller to return data from Valuesets class.
  3. Verify JSON output matches the current schema to ensure no frontend breaks.

Last updated: 2026-01-09 12:47:00