import json from django.core.management.base import BaseCommand, CommandError from control_plane.model_studio.services import ModelStudioService from control_plane.model_studio.models import TrainingProject class Command(BaseCommand): help = "Classify Guard dataset manifests and record provenance/contamination evidence without changing source data." def add_arguments(self, parser): parser.add_argument("--project", required=True, help="TrainingProject slug") def handle(self, *args, **options): project = TrainingProject.objects.filter(slug=options["project"]).first() if project is None: raise CommandError("TrainingProject not found.") report = ModelStudioService().curate_guard_datasets(project) self.stdout.write(json.dumps({key: report[key] for key in ["total", "valid", "warning", "blocked", "decision"]}, indent=2))