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:
- 001-testdef.md (Test Definition Architecture)
- 002-valueset.md (Valueset Replacement)
1. Suggestion 001: Test Definition Architecture
Action: DEFERRED
- We will skip the architectural overhaul of the
testdefmodule 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
valuesettable into a centralized PHP constant or config file namedValuesets.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
- Create
Valuesets.phpin the backend libraries folder. - Refactor
Valuesetcontroller to return data fromValuesetsclass. - Verify JSON output matches the current schema to ensure no frontend breaks.
Last updated: 2026-01-09 12:47:00