Skip to content

Commit

Permalink
BAH-3181 | Configuration support for concept name label to be shown o…
Browse files Browse the repository at this point in the history
…n FSN if specified (Bahmni#792)

* BAH-3181 | Configuration support for concept name label to be shown on FSN or default SN

"conceptFSN" configuration support in Obs display control, so that the concept name labels can be shown in FSN.
If nothing specified default behavior of showing in SN (or FSN in SN is not available) is retained.

This also resolves the bug where in non-implementation locale usage by user (e,g. default locale = en, user locale = french), the obs display control would not show non-matching concept names, even though the API returned the right data.

* BAH-3181 | Fixed issue of always showing concept name in implementation locale
  • Loading branch information
angshu committed Dec 7, 2023
1 parent 4b4f598 commit bb56ce5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ angular.module('bahmni.common.displaycontrol.observation')
if ($scope.config.conceptNames) {
observations = _.filter(observations, function (observation) {
return _.some($scope.config.conceptNames, function (conceptName) {
return _.toLower(conceptName) === _.toLower(_.get(observation, 'concept.name'));
var comparableAttr = observation.conceptFSN != null ? 'conceptFSN' : 'concept.name';
return _.toLower(conceptName) === _.toLower(_.get(observation, comparableAttr));
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
<ul>
<show-observation show-details-button="::config.showDetailsButton" patient="::patient"
observation="::observation"
level="2"></show-observation>
level="2" display-name-type="::config.displayNameType"></show-observation>
</ul>
</li>
</ul>
<ul style="background-color:white;max-width:100%;overflow-x:hidden;" ng-if="obsGroup.isOpen && config.isObservationForImages && isOnDashboard"
class="print-observations hidden-print obs-groups-container">
<show-observation show-details-button="::config.showDetailsButton" patient="::patient"
observation="::observation" ng-repeat="observation in obsGroup.value"
level="2" config-is-observation-for-images="::config.isObservationForImages"></show-observation>
level="2" config-is-observation-for-images="::config.isObservationForImages" display-name-type="::config.displayNameType"></show-observation>
</ul>
<ul style="background-color:white;max-width:100%;overflow-x:hidden;" ng-if="::(obsGroup.isOpen && config.isObservationForImages && !isOnDashboard)" class="print-observations hidden-print">
<show-observation show-details-button="::config.showDetailsButton" patient="::patient"
observation="::observation" ng-repeat="observation in obsGroup.value"
level="2" config-is-observation-for-images="::config.isObservationForImages"></show-observation>
level="2" config-is-observation-for-images="::config.isObservationForImages" display-name-type="::config.displayNameType"></show-observation>
</ul>
<ul ng-if="obsGroup.isOpen && !config.isObservationForImages" class="print-observations hidden-print">
<show-observation show-details-button="::config.showDetailsButton" patient="::patient"
observation="::observation" ng-repeat="observation in obsGroup.value"
level="2" config-is-observation-for-images="::config.isObservationForImages"></show-observation>
level="2" config-is-observation-for-images="::config.isObservationForImages" display-name-type="::config.displayNameType"></show-observation>
</ul>
</li>
</ul>
Expand Down
10 changes: 9 additions & 1 deletion ui/app/common/obs/directives/showObservation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ angular.module('bahmni.common.obs')
}
});
};
$scope.displayLabel = function (observation) {
if ($scope.displayNameType === 'FSN') {
return observation.concept.name;
} else {
return (observation.concept.shortName.charAt(0).toUpperCase() + observation.concept.shortName.slice(1)) || observation.concept.name;
}
};
};
return {
restrict: 'E',
Expand All @@ -40,7 +47,8 @@ angular.module('bahmni.common.obs')
showDate: "=?",
showTime: "=?",
showDetailsButton: "=?",
configIsObservationForImages: "=?"
configIsObservationForImages: "=?",
displayNameType: "=?"
},
controller: controller,
template: '<ng-include src="\'../common/obs/views/showObservation.html\'" />'
Expand Down
6 changes: 3 additions & 3 deletions ui/app/common/obs/views/showObservation.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<label>{{::(observation.getDisplayValue())}}</label>
</span>
<span ng-if="observation.groupMembers.length==0 && !configIsObservationForImages && observation.concept.conceptClass != 'Image'" class="testUnderPanel left">
<label>{{::((observation.concept.shortName.charAt(0).toUpperCase() + observation.concept.shortName.slice(1)) || observation.concept.name)}}</label>
<label>{{::displayLabel(observation)}}</label>
<hint concept-details="::{
lowNormal:observation.lowNormal||observation.concept.lowNormal,
hiNormal:observation.hiNormal||observation.concept.hiNormal,
Expand Down Expand Up @@ -72,12 +72,12 @@
<show-observation show-details-button="::showDetailsButton" ng-if="::!observation.isFormElement()" ng-repeat="member in observation.groupMembers"
observation="::member" patient="::patient" show-date="::showDate" show-time="::showTime"
config-is-observation-for-images="::configIsObservationForImages"
ng-class="{'video-concept-show': member.isVideoConcept()}"></show-observation>
ng-class="{'video-concept-show': member.isVideoConcept()}" display-name-type="::displayNameType"></show-observation>
</ul>
</div>
<ul ng-if="::(!observation.isFormElement() && print && !observation.isConceptClassConceptDetails())" class="visible-print">
<show-observation show-details-button="showDetailsButton" ng-if="::!observation.isFormElement()" ng-repeat="member in observation.groupMembers"
observation="::member" patient="::patient" show-date="::showDate" show-time="::showTime"
config-is-observation-for-images="::configIsObservationForImages"></show-observation>
config-is-observation-for-images="::configIsObservationForImages" display-name-type="::displayNameType"></show-observation>
</ul>
</li>

0 comments on commit bb56ce5

Please sign in to comment.