The Analytics section provides a dashboard that allows administrators to view the current state of Know Your Customer (KYC) processes for the platform. This includes various metrics and visualizations to help understand the approval statuses and overall progress of KYC verifications. Data is sourced from the KYC API endpoint, /api:BVaDN9hl/kyc/analytics, which runs the App\Http\Controllers\Admin\KYCController@stats method and returns json data for the dashboard.
{
"total_users": 4993,
"stats": {
"uninitiated": "21.55 %",
"": "0.54 %",
"approved": "0.02 %",
"declined": "0.16 %",
"pending": "23.01 %"
}
}
The Analytics section shows a card for the total number of users on the platform.
class KYCController extends Controller
{
public function stats()
{
$total_users = User::count();
#
#
#
return [
'total_users' => $total_no_users,
The Approval Statuses section displays the percentage of users in each KYC approval status category. The categories include:
The data is displayed in cards with the percentage of users in each category.
$kyc_statuses = KYC::query()
->selectRaw("status, COUNT('status')")
->groupBy('status')
->get()
->toArray();
$stats = array();
$stats['uninitiated'] = 0;
foreach($kyc_statuses as $stat) {
if (empty($stat['status']) || $stat['status'] === "") {
$stats['uninitiated'] += $stat['count'];
}
$stats[$stat['status']] = number_format(($stat['count'] / $total_no_users) * 100, 2) . ' %';
}
$stats['uninitiated'] = number_format(($stats['uninitiated'] / $total_no_users) * 100, 2) . ' %';
return [
'total_users' => $total_no_users,
'stats' => $stats
];
}