HH/check_surveys.py
2026-01-24 15:27:30 +03:00

20 lines
711 B
Python

#!/usr/bin/env python
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.dev')
django.setup()
from apps.surveys.models import SurveyInstance
print("=== Survey Instances ===")
print(f"Total Survey Instances: {SurveyInstance.objects.count()}")
print(f"Pending Surveys: {SurveyInstance.objects.filter(status='pending').count()}")
print(f"\nRecent Surveys (last 10):")
for s in SurveyInstance.objects.all().order_by('-created_at')[:10]:
patient_name = s.patient.get_full_name() if s.patient else "Unknown"
print(f" - {s.id}: {patient_name} ({s.status}) - {s.created_at}")
if s.journey_instance:
print(f" Journey: {s.journey_instance.encounter_id}")