fix: correct ValueSet transformLabels output format

- ValueSet::transformLabels() was outputting values incorrectly:
  - Field contained label text (e.g., Race: 'Jawa')
  - *Key contained original value (e.g., RaceKey: 'JAWA')

- Fixed to output correct format for all static JSON ValueSets:
  - Field contains original value (e.g., Race: 'JAWA')
  - *Label contains label text (e.g., RaceLabel: 'Jawa')

- Affected ValueSets: Race, Sex, Country, Religion, Ethnic,
  DeathIndicator, MaritalStatus

- Patient show endpoint now returns: Race:'JAWA', RaceLabel:'Jawa',
  Sex:'1', SexLabel:'Female' as expected
This commit is contained in:
mahdahar 2026-01-29 09:56:45 +07:00
parent 6a20682d18
commit bf847b6835

View File

@ -69,8 +69,8 @@ class ValueSet {
foreach ($fieldMappings as $field => $lookupName) {
if (isset($row[$field]) && $row[$field] !== null) {
$keyValue = $row[$field];
$row[$field . 'Key'] = $keyValue;
$row[$field] = self::getLabel($lookupName, $keyValue) ?? '';
$row[$field] = $keyValue;
$row[$field . 'Label'] = self::getLabel($lookupName, $keyValue) ?? '';
}
}
}