fix bugs
This commit is contained in:
@@ -307,11 +307,11 @@ class DashboardService
|
||||
|
||||
->whereRaw(
|
||||
"(year_data < ?
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data <= ?
|
||||
)
|
||||
)",
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data <= ?
|
||||
)
|
||||
)",
|
||||
[
|
||||
$endYear,
|
||||
$endYear,
|
||||
@@ -386,11 +386,11 @@ class DashboardService
|
||||
|
||||
$q->whereRaw(
|
||||
"(year_data > ?
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data >= ?
|
||||
)
|
||||
)",
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data >= ?
|
||||
)
|
||||
)",
|
||||
[
|
||||
$startYear,
|
||||
$startYear,
|
||||
@@ -400,11 +400,11 @@ class DashboardService
|
||||
|
||||
->whereRaw(
|
||||
"(year_data < ?
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data <= ?
|
||||
)
|
||||
)",
|
||||
OR (
|
||||
year_data = ?
|
||||
AND week_data <= ?
|
||||
)
|
||||
)",
|
||||
[
|
||||
$endYear,
|
||||
$endYear,
|
||||
@@ -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")')
|
||||
->selectRaw("
|
||||
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
|
||||
")
|
||||
->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"')
|
||||
->selectRaw("
|
||||
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
|
||||
")
|
||||
->groupBy(
|
||||
|
||||
@@ -56,7 +56,7 @@ Chart.register({
|
||||
|
||||
ctx.font = '12px sans-serif';
|
||||
ctx.fillStyle = '#6b7280';
|
||||
ctx.fillText('Total cases', centerX, centerY + 12);
|
||||
ctx.fillText('Total Positive cases', centerX, centerY + 12);
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
@@ -377,19 +377,14 @@ export function buildDistributionChart(
|
||||
}
|
||||
export function getSubtypeColor(label, index = 0) {
|
||||
|
||||
const specialColors = {
|
||||
'A/H5N1': '#dc2626',
|
||||
'Influenza': '#b90c00'
|
||||
};
|
||||
|
||||
return specialColors[label]
|
||||
return SUBTYPE_COLORS[label]
|
||||
|| COLORS[index % COLORS.length];
|
||||
}
|
||||
|
||||
export const COLORS = [
|
||||
|
||||
'#ef4444', // blue
|
||||
'#10b981', // emerald
|
||||
'#ef4444',
|
||||
'#f59e0b', // amber
|
||||
'#ef4444', // red
|
||||
'#8b5cf6', // violet
|
||||
@@ -398,7 +393,6 @@ export const COLORS = [
|
||||
'#84cc16', // lime
|
||||
'#e11dba', // fuchsia
|
||||
'#f6f63b', // yellow
|
||||
|
||||
'#0ea5e9', // sky
|
||||
'#22c55e', // green
|
||||
'#a855f7', // purple
|
||||
@@ -428,6 +422,7 @@ export const SUBTYPE_COLORS = {
|
||||
'A/Unsubtypable': '#f455d7',
|
||||
'B/Yam': '#9333ea',
|
||||
'B/Vic': '#086037',
|
||||
'B/VIC': '#086037',
|
||||
'B/Unsubtypable': '#66ff00',
|
||||
'B/Victoria': '#9333ea',
|
||||
'H1N1pdm': '#f0d401',
|
||||
|
||||
@@ -197,10 +197,7 @@ function loadTrend(periodType, startYear, startWeek, endYear, endWeek) {
|
||||
grid: {
|
||||
display: false
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Surveillance'
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,15 +212,16 @@ function loadInfluenzaSubtypeDistribution(periodType, startYear, startWeek, endY
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
|
||||
const displayData = data.map(item => ({
|
||||
...item,
|
||||
subtype: item.subtype === "B/VIC" ? "B/Vic" : item.subtype
|
||||
}));
|
||||
data.forEach(row => {
|
||||
if (row.subtype === 'B/VIC') {
|
||||
row.subtype = 'B/Vic';
|
||||
}
|
||||
});
|
||||
|
||||
Charts.buildDistributionChart(
|
||||
'influenzaSubtypeDistribution',
|
||||
'bar',
|
||||
displayData,
|
||||
data,
|
||||
'subtype',
|
||||
'total',
|
||||
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 datasets = lineages.map((lineage, index) => {
|
||||
|
||||
const lineageData = periods.map(period => {
|
||||
@@ -886,11 +882,6 @@ function getRadius(total) {
|
||||
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() {
|
||||
|
||||
@@ -1202,9 +1193,7 @@ function loadProvinceMap(
|
||||
[lat, lng],
|
||||
{
|
||||
radius: getRadius(row.total),
|
||||
fillColor: getColorByPathogen(
|
||||
row.pathogen_name === 'B/VIC' ? 'B/Vic' : row.pathogen_name
|
||||
),
|
||||
fillColor: Charts.SUBTYPE_COLORS[row.pathogen_name === 'B/VIC' ? 'B/Vic' : row.pathogen_name] || '#9ca3af',
|
||||
fillOpacity: 0.85,
|
||||
stroke: false
|
||||
}
|
||||
|
||||
@@ -563,11 +563,11 @@ function renderProgramTrend(rows = []) {
|
||||
|
||||
}),
|
||||
|
||||
color: '#d21919'
|
||||
color: '#ef4444'
|
||||
},
|
||||
|
||||
{
|
||||
label: 'COVID-19 %',
|
||||
label: 'SARS-CoV-2 %',
|
||||
|
||||
data: labels.map(label => {
|
||||
|
||||
@@ -843,12 +843,10 @@ function renderAFITrend(
|
||||
|
|
||||
*/
|
||||
|
||||
const donutTotal =
|
||||
|
||||
totalCases.reduce(
|
||||
(a, b) => a + b,
|
||||
0
|
||||
);
|
||||
const donutTotal = rows.reduce(
|
||||
(sum, row) => sum + Number(row.total_positive || 0),
|
||||
0
|
||||
);
|
||||
|
||||
if (Charts.charts[canvasId]) {
|
||||
|
||||
@@ -946,6 +944,11 @@ function renderSentinel(rows = []) {
|
||||
}
|
||||
function renderSubtypeChart(rows = []) {
|
||||
|
||||
rows.forEach(row => {
|
||||
if (row.subtype === 'B/VIC') {
|
||||
row.subtype = 'B/Vic';
|
||||
}
|
||||
});
|
||||
|
||||
Charts.buildDistributionChart(
|
||||
'subtypeChart',
|
||||
|
||||
@@ -5,41 +5,33 @@ use App\Http\Controllers\DashboardController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
|
||||
return auth()->check()
|
||||
? redirect()->route('dashboard')
|
||||
: redirect()->route('login');
|
||||
|
||||
});
|
||||
|
||||
Route::get('/dashboard', function () {
|
||||
return view('dashboard');
|
||||
})->middleware(['auth', 'verified'])->name('dashboard');
|
||||
|
||||
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'])
|
||||
->name('dashboard');
|
||||
|
||||
Route::get('/dashboard/seq', function () {
|
||||
return view('dashboard.sequencing');
|
||||
});
|
||||
|
||||
Route::get('/dashboard/{code}', [DashboardController::class, '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::get('/admin/users', function () {
|
||||
return view('admin.users');
|
||||
});
|
||||
|
||||
Route::get('/admin/settings', function () {
|
||||
return view('admin.settings');
|
||||
});
|
||||
|
||||
Route::view('/admin/users', 'admin.users');
|
||||
Route::view('/admin/settings', 'admin.settings');
|
||||
});
|
||||
|
||||
Route::get('/debug', function () {
|
||||
return response()->json([
|
||||
'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