forked from Bahmni/openmrs-module-bahmniapps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged current master with tag 1.0.0 branch
- Loading branch information
Showing
161 changed files
with
5,127 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
function command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
if ! command_exists tx; then | ||
echo "Transifex CLI is not installed. Installing..." | ||
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | ||
mv tx /usr/local/bin/tx | ||
fi | ||
|
||
if [ ! -f .tx/config ]; then | ||
echo "Transifex config file (.tx/config) not found in the repository." | ||
exit 1 | ||
fi | ||
|
||
echo "Pushing translation source file to Transifex..." | ||
tx push -s | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error: Transifex push failed. Please check the error message above." | ||
exit 1 | ||
else | ||
echo "Translation source file successfully pushed to Transifex." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
'use strict'; | ||
|
||
angular.module('bahmni.admin') | ||
.controller('FHIRExportController', ['$rootScope', '$scope', '$q', '$http', '$translate', 'messagingService', 'fhirExportService', function ($rootScope, $scope, $q, $http, $translate, messagingService, fhirExportService) { | ||
var DateUtil = Bahmni.Common.Util.DateUtil; | ||
|
||
var convertToLocalDate = function (date) { | ||
var localDate = DateUtil.parseLongDateToServerFormat(date); | ||
return DateUtil.getDateTimeInSpecifiedFormat(localDate, 'MMMM Do, YYYY [at] h:mm:ss A'); | ||
}; | ||
|
||
var subtractDaysFromToday = function (minusDays) { | ||
const currentDate = new Date(); | ||
currentDate.setDate(currentDate.getDate() - minusDays); | ||
return currentDate; | ||
}; | ||
|
||
$scope.startDate = subtractDaysFromToday(30); | ||
$scope.endDate = subtractDaysFromToday(0); | ||
|
||
$scope.anonymise = true; | ||
|
||
var isLoggedInUserPrivileged = function (expectedPrivileges) { | ||
var currentPrivileges = _.map($rootScope.currentUser.privileges, function (privilege) { | ||
return privilege.name; | ||
}); | ||
var hasPrivilege = expectedPrivileges.some(function (privilege) { | ||
return currentPrivileges.indexOf(privilege) !== -1; | ||
}); | ||
return hasPrivilege; | ||
}; | ||
|
||
var hasInsufficientPrivilegeForPlainExport = function () { | ||
var plainExportPrivileges = [Bahmni.Common.Constants.plainFhirExportPrivilege]; | ||
var hasPlainExportPrivilege = isLoggedInUserPrivileged(plainExportPrivileges); | ||
return !hasPlainExportPrivilege; | ||
}; | ||
$scope.isCheckboxDisabled = hasInsufficientPrivilegeForPlainExport(); | ||
|
||
var isUserPrivilegedForFhirExport = function () { | ||
var defaultExportPrivileges = [Bahmni.Common.Constants.fhirExportPrivilege, Bahmni.Common.Constants.plainFhirExportPrivilege]; | ||
return isLoggedInUserPrivileged(defaultExportPrivileges); | ||
}; | ||
$scope.hasExportPrivileges = isUserPrivilegedForFhirExport(); | ||
|
||
$scope.loadFhirTasksForPrivilegedUsers = function () { | ||
var deferred = $q.defer(); | ||
$scope.tasks = []; | ||
if (isUserPrivilegedForFhirExport()) { | ||
fhirExportService.getUuidForAnonymiseConcept().then(function (response) { | ||
$scope.uuid = response && response.data && response.data.results && response.data.results[0] && response.data.results[0].uuid || null; | ||
}); | ||
fhirExportService.loadFhirTasks().then(function (response) { | ||
if (response.data && response.data.entry) { | ||
var fhirExportTasks = response.data.entry.filter(function (task) { | ||
return task.resource.basedOn && task.resource.basedOn.some(function (basedOn) { | ||
return basedOn.reference === $scope.uuid; | ||
}); | ||
}); | ||
$scope.tasks = fhirExportTasks.map(function (task) { | ||
task.resource.authoredOn = convertToLocalDate(task.resource.authoredOn); | ||
return task; | ||
}); | ||
deferred.resolve(); | ||
} | ||
}).catch(function (error) { | ||
deferred.reject(error); | ||
}); | ||
} | ||
return deferred.promise; | ||
}; | ||
|
||
$scope.loadFhirTasksForPrivilegedUsers(); | ||
|
||
$scope.exportFhirData = function () { | ||
var deferred = $q.defer(); | ||
var startDate = DateUtil.getDateWithoutTime($scope.startDate); | ||
var endDate = DateUtil.getDateWithoutTime($scope.endDate); | ||
var anonymise = $scope.anonymise; | ||
var username = $rootScope.currentUser.username; | ||
|
||
fhirExportService.export(username, startDate, endDate, anonymise).success(function () { | ||
fhirExportService.submitAudit(username, startDate, endDate, anonymise).success(function () { | ||
messagingService.showMessage("info", $translate.instant("EXPORT_PATIENT_REQUEST_SUBMITTED")); | ||
$scope.loadFhirTasksForPrivilegedUsers(); | ||
deferred.resolve(); | ||
}); | ||
}).catch(function (error) { | ||
messagingService.showMessage("error", $translate.instant("EXPORT_PATIENT_REQUEST_SUBMIT_ERROR")); | ||
console.error("FHIR Export request failed"); | ||
deferred.reject(error); | ||
}); | ||
return deferred.promise; | ||
}; | ||
|
||
$scope.extractAttribute = function (array, searchValue, attributeToExtract) { | ||
var foundElement = array && array.find(function (inputElement) { return inputElement.type.text === searchValue; }); | ||
if (foundElement && foundElement.hasOwnProperty(attributeToExtract)) { | ||
return foundElement[attributeToExtract]; | ||
} | ||
return null; | ||
}; | ||
|
||
$scope.extractBoolean = function (array, searchValue, attributeToExtract) { | ||
var booleanStr = $scope.extractAttribute(array, searchValue, attributeToExtract); | ||
return booleanStr && booleanStr.toLowerCase() === "true"; | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.