HH/apps/integrations/management/commands/check_mapping_data.py

17 lines
801 B
Python

from django.core.management.base import BaseCommand
from apps.organizations.models import Hospital
from apps.surveys.models import SurveyTemplate
class Command(BaseCommand):
help = 'Check hospitals and survey templates in database'
def handle(self, *args, **options):
self.stdout.write('=== HOSPITALS ===')
for h in Hospital.objects.all()[:10]:
self.stdout.write(f'ID: {h.id}, Name: {h.name}')
self.stdout.write(f'\nTotal Hospitals: {Hospital.objects.count()}')
self.stdout.write('\n=== SURVEY TEMPLATES ===')
for s in SurveyTemplate.objects.all()[:10]:
self.stdout.write(f'ID: {s.id}, Name: {s.name}, Hospital: {s.hospital_id}')
self.stdout.write(f'\nTotal Survey Templates: {SurveyTemplate.objects.count()}')