fix bugs
This commit is contained in:
@@ -1063,7 +1063,7 @@ class DashboardService
|
|||||||
->whereRaw('case_lab_results.is_positive = 1 and surveillance_cases.surveillance_id=6 and case_lab_results.indicator="Covid-19" and case_lab_results.pathogen_name not in("","unable to align","N/A","NA")')
|
->whereRaw('case_lab_results.is_positive = 1 and surveillance_cases.surveillance_id=6 and case_lab_results.indicator="Covid-19" and case_lab_results.pathogen_name not in("","unable to align","N/A","NA")')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
case_lab_results.pathogen_name as lineage,
|
case_lab_results.pathogen_name as lineage,
|
||||||
concat(surveillance_cases.year_data,'-',surveillance_cases.week_data) as week,
|
concat(surveillance_cases.year_data,'-W',surveillance_cases.week_data) as week,
|
||||||
COUNT(DISTINCT surveillance_cases.lab_code) as total
|
COUNT(DISTINCT surveillance_cases.lab_code) as total
|
||||||
")
|
")
|
||||||
->groupBy(
|
->groupBy(
|
||||||
@@ -1091,7 +1091,7 @@ class DashboardService
|
|||||||
->whereRaw('case_lab_results.is_positive = 1 and surveillance_cases.surveillance_id not in(6) and case_lab_results.indicator="Influenza"')
|
->whereRaw('case_lab_results.is_positive = 1 and surveillance_cases.surveillance_id not in(6) and case_lab_results.indicator="Influenza"')
|
||||||
->selectRaw("
|
->selectRaw("
|
||||||
case_lab_results.subtype as lineage,
|
case_lab_results.subtype as lineage,
|
||||||
concat(surveillance_cases.year_data,'-',surveillance_cases.week_data) as week,
|
concat(surveillance_cases.year_data,'-W',surveillance_cases.week_data) as week,
|
||||||
COUNT(DISTINCT surveillance_cases.lab_code) as total
|
COUNT(DISTINCT surveillance_cases.lab_code) as total
|
||||||
")
|
")
|
||||||
->groupBy(
|
->groupBy(
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ Chart.register({
|
|||||||
|
|
||||||
ctx.font = '12px sans-serif';
|
ctx.font = '12px sans-serif';
|
||||||
ctx.fillStyle = '#6b7280';
|
ctx.fillStyle = '#6b7280';
|
||||||
ctx.fillText('Total cases', centerX, centerY + 12);
|
ctx.fillText('Total Positive cases', centerX, centerY + 12);
|
||||||
|
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
@@ -377,19 +377,14 @@ export function buildDistributionChart(
|
|||||||
}
|
}
|
||||||
export function getSubtypeColor(label, index = 0) {
|
export function getSubtypeColor(label, index = 0) {
|
||||||
|
|
||||||
const specialColors = {
|
return SUBTYPE_COLORS[label]
|
||||||
'A/H5N1': '#dc2626',
|
|
||||||
'Influenza': '#b90c00'
|
|
||||||
};
|
|
||||||
|
|
||||||
return specialColors[label]
|
|
||||||
|| COLORS[index % COLORS.length];
|
|| COLORS[index % COLORS.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const COLORS = [
|
export const COLORS = [
|
||||||
|
|
||||||
'#ef4444', // blue
|
|
||||||
'#10b981', // emerald
|
'#10b981', // emerald
|
||||||
|
'#ef4444',
|
||||||
'#f59e0b', // amber
|
'#f59e0b', // amber
|
||||||
'#ef4444', // red
|
'#ef4444', // red
|
||||||
'#8b5cf6', // violet
|
'#8b5cf6', // violet
|
||||||
@@ -398,7 +393,6 @@ export const COLORS = [
|
|||||||
'#84cc16', // lime
|
'#84cc16', // lime
|
||||||
'#e11dba', // fuchsia
|
'#e11dba', // fuchsia
|
||||||
'#f6f63b', // yellow
|
'#f6f63b', // yellow
|
||||||
|
|
||||||
'#0ea5e9', // sky
|
'#0ea5e9', // sky
|
||||||
'#22c55e', // green
|
'#22c55e', // green
|
||||||
'#a855f7', // purple
|
'#a855f7', // purple
|
||||||
@@ -428,6 +422,7 @@ export const SUBTYPE_COLORS = {
|
|||||||
'A/Unsubtypable': '#f455d7',
|
'A/Unsubtypable': '#f455d7',
|
||||||
'B/Yam': '#9333ea',
|
'B/Yam': '#9333ea',
|
||||||
'B/Vic': '#086037',
|
'B/Vic': '#086037',
|
||||||
|
'B/VIC': '#086037',
|
||||||
'B/Unsubtypable': '#66ff00',
|
'B/Unsubtypable': '#66ff00',
|
||||||
'B/Victoria': '#9333ea',
|
'B/Victoria': '#9333ea',
|
||||||
'H1N1pdm': '#f0d401',
|
'H1N1pdm': '#f0d401',
|
||||||
|
|||||||
@@ -197,10 +197,7 @@ function loadTrend(periodType, startYear, startWeek, endYear, endWeek) {
|
|||||||
grid: {
|
grid: {
|
||||||
display: false
|
display: false
|
||||||
},
|
},
|
||||||
title: {
|
|
||||||
display: true,
|
|
||||||
text: 'Surveillance'
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,15 +212,16 @@ function loadInfluenzaSubtypeDistribution(periodType, startYear, startWeek, endY
|
|||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
||||||
const displayData = data.map(item => ({
|
data.forEach(row => {
|
||||||
...item,
|
if (row.subtype === 'B/VIC') {
|
||||||
subtype: item.subtype === "B/VIC" ? "B/Vic" : item.subtype
|
row.subtype = 'B/Vic';
|
||||||
}));
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Charts.buildDistributionChart(
|
Charts.buildDistributionChart(
|
||||||
'influenzaSubtypeDistribution',
|
'influenzaSubtypeDistribution',
|
||||||
'bar',
|
'bar',
|
||||||
displayData,
|
data,
|
||||||
'subtype',
|
'subtype',
|
||||||
'total',
|
'total',
|
||||||
label => Charts.SUBTYPE_COLORS[label] || '#9ca3af'
|
label => Charts.SUBTYPE_COLORS[label] || '#9ca3af'
|
||||||
@@ -260,8 +258,6 @@ function loadCovidLineageFrequency(periodType, startYear, startWeek, endYear, en
|
|||||||
|
|
||||||
const lineages = [...new Set(data.map(item => item.lineage))];
|
const lineages = [...new Set(data.map(item => item.lineage))];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const datasets = lineages.map((lineage, index) => {
|
const datasets = lineages.map((lineage, index) => {
|
||||||
|
|
||||||
const lineageData = periods.map(period => {
|
const lineageData = periods.map(period => {
|
||||||
@@ -886,11 +882,6 @@ function getRadius(total) {
|
|||||||
return Math.max(4, Math.min(r * 2, 22));
|
return Math.max(4, Math.min(r * 2, 22));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPositivityColor(subtype) {
|
|
||||||
return Charts.SUBTYPE_COLORS[subtype] || "#9ca3af";
|
|
||||||
}
|
|
||||||
const getColorByPathogen = name =>
|
|
||||||
Charts.SUBTYPE_COLORS[name] || '#9ca3af';
|
|
||||||
|
|
||||||
function addPositivityLegend() {
|
function addPositivityLegend() {
|
||||||
|
|
||||||
@@ -1202,9 +1193,7 @@ function loadProvinceMap(
|
|||||||
[lat, lng],
|
[lat, lng],
|
||||||
{
|
{
|
||||||
radius: getRadius(row.total),
|
radius: getRadius(row.total),
|
||||||
fillColor: getColorByPathogen(
|
fillColor: Charts.SUBTYPE_COLORS[row.pathogen_name === 'B/VIC' ? 'B/Vic' : row.pathogen_name] || '#9ca3af',
|
||||||
row.pathogen_name === 'B/VIC' ? 'B/Vic' : row.pathogen_name
|
|
||||||
),
|
|
||||||
fillOpacity: 0.85,
|
fillOpacity: 0.85,
|
||||||
stroke: false
|
stroke: false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -563,11 +563,11 @@ function renderProgramTrend(rows = []) {
|
|||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
color: '#d21919'
|
color: '#ef4444'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: 'COVID-19 %',
|
label: 'SARS-CoV-2 %',
|
||||||
|
|
||||||
data: labels.map(label => {
|
data: labels.map(label => {
|
||||||
|
|
||||||
@@ -843,10 +843,8 @@ function renderAFITrend(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const donutTotal =
|
const donutTotal = rows.reduce(
|
||||||
|
(sum, row) => sum + Number(row.total_positive || 0),
|
||||||
totalCases.reduce(
|
|
||||||
(a, b) => a + b,
|
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -946,6 +944,11 @@ function renderSentinel(rows = []) {
|
|||||||
}
|
}
|
||||||
function renderSubtypeChart(rows = []) {
|
function renderSubtypeChart(rows = []) {
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
if (row.subtype === 'B/VIC') {
|
||||||
|
row.subtype = 'B/Vic';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Charts.buildDistributionChart(
|
Charts.buildDistributionChart(
|
||||||
'subtypeChart',
|
'subtypeChart',
|
||||||
|
|||||||
@@ -5,41 +5,33 @@ use App\Http\Controllers\DashboardController;
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
|
|
||||||
return auth()->check()
|
return auth()->check()
|
||||||
? redirect()->route('dashboard')
|
? redirect()->route('dashboard')
|
||||||
: redirect()->route('login');
|
: redirect()->route('login');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/dashboard', function () {
|
|
||||||
return view('dashboard');
|
|
||||||
})->middleware(['auth', 'verified'])->name('dashboard');
|
|
||||||
|
|
||||||
Route::middleware('auth')->group(function () {
|
Route::middleware('auth')->group(function () {
|
||||||
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
|
||||||
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
|
||||||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
|
||||||
Route::get('/dashboard', [DashboardController::class, 'overview'])
|
Route::get('/dashboard', [DashboardController::class, 'overview'])
|
||||||
->name('dashboard');
|
->name('dashboard');
|
||||||
|
|
||||||
Route::get('/dashboard/seq', function () {
|
Route::get('/dashboard/seq', function () {
|
||||||
return view('dashboard.sequencing');
|
return view('dashboard.sequencing');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/dashboard/{code}', [DashboardController::class, 'detail'])
|
Route::get('/dashboard/{code}', [DashboardController::class, 'detail'])
|
||||||
->name('dashboard.detail');
|
->name('dashboard.detail');
|
||||||
|
|
||||||
|
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
||||||
|
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||||
|
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware(['auth', 'role:admin'])->group(function () {
|
Route::middleware(['auth', 'role:admin'])->group(function () {
|
||||||
|
Route::view('/admin/users', 'admin.users');
|
||||||
Route::get('/admin/users', function () {
|
Route::view('/admin/settings', 'admin.settings');
|
||||||
return view('admin.users');
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('/admin/settings', function () {
|
|
||||||
return view('admin.settings');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/debug', function () {
|
Route::get('/debug', function () {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'host' => request()->getHost(),
|
'host' => request()->getHost(),
|
||||||
@@ -50,4 +42,4 @@ Route::get('/debug', function () {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
require __DIR__ . '/auth.php';
|
require __DIR__.'/auth.php';
|
||||||
Reference in New Issue
Block a user