66 lines
4.1 KiB
Python
66 lines
4.1 KiB
Python
<<<<<<< HEAD
|
|
# Generated by Django 6.0 on 2026-01-12 09:50
|
|
=======
|
|
# Generated by Django 6.0.1 on 2026-01-12 09:50
|
|
>>>>>>> 1f9d8a7 (update on the complaint sla and staff hierarchy)
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('organizations', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='KPI',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=200, unique=True)),
|
|
('name_ar', models.CharField(blank=True, max_length=200)),
|
|
('description', models.TextField(blank=True)),
|
|
('category', models.CharField(choices=[('patient_satisfaction', 'Patient Satisfaction'), ('complaint_management', 'Complaint Management'), ('action_management', 'Action Management'), ('sla_compliance', 'SLA Compliance'), ('survey_response', 'Survey Response'), ('operational', 'Operational')], db_index=True, max_length=100)),
|
|
('unit', models.CharField(help_text='Unit of measurement (%, count, hours, etc.)', max_length=50)),
|
|
('calculation_method', models.TextField(help_text='Description of how this KPI is calculated')),
|
|
('target_value', models.DecimalField(blank=True, decimal_places=2, help_text='Target value for this KPI', max_digits=10, null=True)),
|
|
('warning_threshold', models.DecimalField(blank=True, decimal_places=2, help_text='Warning threshold', max_digits=10, null=True)),
|
|
('critical_threshold', models.DecimalField(blank=True, decimal_places=2, help_text='Critical threshold', max_digits=10, null=True)),
|
|
('is_active', models.BooleanField(default=True)),
|
|
],
|
|
options={
|
|
'verbose_name': 'KPI',
|
|
'verbose_name_plural': 'KPIs',
|
|
'ordering': ['category', 'name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='KPIValue',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('value', models.DecimalField(decimal_places=2, max_digits=10)),
|
|
('period_start', models.DateTimeField(db_index=True)),
|
|
('period_end', models.DateTimeField(db_index=True)),
|
|
('period_type', models.CharField(choices=[('hourly', 'Hourly'), ('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('quarterly', 'Quarterly'), ('yearly', 'Yearly')], default='daily', max_length=20)),
|
|
('status', models.CharField(choices=[('on_target', 'On Target'), ('warning', 'Warning'), ('critical', 'Critical')], db_index=True, max_length=20)),
|
|
('metadata', models.JSONField(blank=True, default=dict, help_text='Additional calculation details')),
|
|
('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='kpi_values', to='organizations.department')),
|
|
('hospital', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='kpi_values', to='organizations.hospital')),
|
|
('kpi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='values', to='analytics.kpi')),
|
|
],
|
|
options={
|
|
'ordering': ['-period_end'],
|
|
'indexes': [models.Index(fields=['kpi', '-period_end'], name='analytics_k_kpi_id_f9c38d_idx'), models.Index(fields=['hospital', 'kpi', '-period_end'], name='analytics_k_hospita_356dca_idx')],
|
|
},
|
|
),
|
|
]
|