@@ -302,6 +302,34 @@ def to_representation(self, instance):
302302class TrainingViewSet (
303303 viewsets .ModelViewSet
304304): # This is TrainingViewSet , will be tightly coupled with the models
305+ """
306+ API endpoint for managing Training jobs.
307+
308+ retrieve:
309+ Return the details of a specific training job by ID, including feedback and approved predictions count.
310+
311+ list:
312+ Return a list of all training jobs. Supports filtering, searching, and ordering.
313+
314+ create:
315+ Create a new training job. Requires authentication. Only one active training per model is allowed.
316+
317+ delete:
318+ Delete a training job. Requires authentication and ownership.
319+
320+ Filtering:
321+ - model, status, user, id (exact matches)
322+
323+ Searching:
324+ - description, id, model__name
325+
326+ Ordering:
327+ - created_at, accuracy, id, model, status
328+
329+ Permissions:
330+ - Only authenticated users can create or delete training jobs.
331+ - Read-only access for unauthenticated users (GET methods).
332+ """
305333 authentication_classes = [OsmAuthentication ]
306334 permission_classes = [IsOsmAuthenticated ]
307335 public_methods = ["GET" ]
@@ -334,6 +362,34 @@ def retrieve(self, request, *args, **kwargs):
334362
335363
336364class FeedbackViewset (viewsets .ModelViewSet ):
365+ """
366+ API endpoint for managing Feedback on training jobs.
367+
368+ retrieve:
369+ Return the details of a specific feedback entry by ID.
370+
371+ list:
372+ Return a list of all feedback entries. Supports filtering.
373+
374+ create:
375+ Create a new feedback entry. Requires authentication.
376+
377+ update:
378+ Update an existing feedback entry. Requires authentication and ownership.
379+
380+ partial_update:
381+ Partially update an existing feedback entry. Requires authentication and ownership.
382+
383+ delete:
384+ Delete a feedback entry. Requires authentication and ownership.
385+
386+ Filtering:
387+ - training, user, action (exact matches)
388+
389+ Permissions:
390+ - Only authenticated users can create, update, or delete feedback entries.
391+ - Read-only access for unauthenticated users (GET methods).
392+ """
337393 authentication_classes = [OsmAuthentication ]
338394 permission_classes = [IsOsmAuthenticated ]
339395 public_methods = ["GET" ]
@@ -351,6 +407,34 @@ class FeedbackViewset(viewsets.ModelViewSet):
351407
352408
353409class FeedbackAOIViewset (viewsets .ModelViewSet ):
410+ """
411+ API endpoint for managing Feedback AOIs (Areas of Interest) related to training jobs.
412+
413+ retrieve:
414+ Return the details of a specific Feedback AOI by ID.
415+
416+ list:
417+ Return a list of all Feedback AOIs. Supports filtering.
418+
419+ create:
420+ Create a new Feedback AOI. Requires authentication.
421+
422+ update:
423+ Update an existing Feedback AOI. Requires authentication and ownership.
424+
425+ partial_update:
426+ Partially update an existing Feedback AOI. Requires authentication and ownership.
427+
428+ delete:
429+ Delete a Feedback AOI. Requires authentication and ownership.
430+
431+ Filtering:
432+ - training, user (exact matches)
433+
434+ Permissions:
435+ - Only authenticated users can create, update, or delete Feedback AOIs.
436+ - Read-only access for unauthenticated users (GET methods).
437+ """
354438 authentication_classes = [OsmAuthentication ]
355439 permission_classes = [IsOsmAuthenticated ]
356440 public_methods = ["GET" ]
@@ -364,6 +448,34 @@ class FeedbackAOIViewset(viewsets.ModelViewSet):
364448
365449
366450class FeedbackLabelViewset (viewsets .ModelViewSet ):
451+ """
452+ API endpoint for managing Feedback Labels associated with Feedback AOIs.
453+
454+ retrieve:
455+ Return the details of a specific Feedback Label by ID.
456+
457+ list:
458+ Return a list of all Feedback Labels. Supports filtering.
459+
460+ create:
461+ Create a new Feedback Label. Requires authentication.
462+
463+ update:
464+ Update an existing Feedback Label. Requires authentication and ownership.
465+
466+ partial_update:
467+ Partially update an existing Feedback Label. Requires authentication and ownership.
468+
469+ delete:
470+ Delete a Feedback Label. Requires authentication and ownership.
471+
472+ Filtering:
473+ - feedback_aoi, feedback_aoi__training (exact matches)
474+
475+ Permissions:
476+ - Only authenticated users can create, update, or delete Feedback Labels.
477+ - Read-only access for unauthenticated users (GET methods).
478+ """
367479 authentication_classes = [OsmAuthentication ]
368480 permission_classes = [IsOsmAuthenticated ]
369481 public_methods = ["GET" ]
@@ -382,6 +494,41 @@ class FeedbackLabelViewset(viewsets.ModelViewSet):
382494class ModelViewSet (
383495 viewsets .ModelViewSet
384496): # This is ModelViewSet , will be tightly coupled with the models
497+ """
498+ API endpoint for managing AI Models.
499+
500+ retrieve:
501+ Return the details of a specific model by ID.
502+
503+ list:
504+ Return a list of all models. Supports filtering, searching, and ordering.
505+
506+ create:
507+ Create a new model. Requires authentication.
508+
509+ update:
510+ Update an existing model. Requires authentication and ownership.
511+
512+ partial_update:
513+ Partially update an existing model. Requires authentication and ownership.
514+
515+ delete:
516+ Delete a model. Requires authentication and ownership.
517+
518+ Filtering:
519+ - status, created_at, last_modified, user, dataset, id (exact matches)
520+ - created_at, last_modified (range: gt, gte, lt, lte)
521+
522+ Searching:
523+ - name, id
524+
525+ Ordering:
526+ - created_at, last_modified, id, status
527+
528+ Permissions:
529+ - Only authenticated users can create, update, or delete models.
530+ - Read-only access for unauthenticated users (GET methods).
531+ """
385532 authentication_classes = [OsmAuthentication ]
386533 permission_classes = [IsOsmAuthenticated ]
387534 public_methods = ["GET" ]
@@ -445,6 +592,34 @@ class UsersView(ListAPIView):
445592
446593
447594class AOIViewSet (viewsets .ModelViewSet ):
595+ """
596+ API endpoint for managing Areas of Interest (AOIs).
597+
598+ retrieve:
599+ Return the details of a specific AOI by ID.
600+
601+ list:
602+ Return a list of all AOIs. Supports filtering.
603+
604+ create:
605+ Create a new AOI. Requires authentication.
606+
607+ update:
608+ Update an existing AOI. Requires authentication and ownership.
609+
610+ partial_update:
611+ Partially update an existing AOI. Requires authentication and ownership.
612+
613+ delete:
614+ Delete an AOI. Requires authentication and ownership.
615+
616+ Filtering:
617+ - dataset (exact match)
618+
619+ Permissions:
620+ - Only authenticated users can create, update, or delete AOIs.
621+ - Read-only access for unauthenticated users (GET methods).
622+ """
448623 authentication_classes = [OsmAuthentication ]
449624 permission_classes = [IsOsmAuthenticated ]
450625 public_methods = ["GET" ]
@@ -456,6 +631,34 @@ class AOIViewSet(viewsets.ModelViewSet):
456631
457632
458633class LabelViewSet (viewsets .ModelViewSet ):
634+ """
635+ API endpoint for managing Labels associated with AOIs.
636+
637+ retrieve:
638+ Return the details of a specific Label by ID.
639+
640+ list:
641+ Return a list of all Labels. Supports filtering.
642+
643+ create:
644+ Create a new Label. Requires authentication.
645+
646+ update:
647+ Update an existing Label. Requires authentication and ownership.
648+
649+ partial_update:
650+ Partially update an existing Label. Requires authentication and ownership.
651+
652+ delete:
653+ Delete a Label. Requires authentication and ownership.
654+
655+ Filtering:
656+ - aoi, aoi__dataset (exact matches)
657+
658+ Permissions:
659+ - Only authenticated users can create, update, or delete Labels.
660+ - Read-only access for unauthenticated users (GET methods).
661+ """
459662 authentication_classes = [OsmAuthentication ]
460663 permission_classes = [IsOsmAuthenticated ]
461664 public_methods = ["GET" ]
@@ -884,6 +1087,31 @@ def get(self, request, lookup_dir):
8841087
8851088
8861089class BannerViewSet (viewsets .ModelViewSet ):
1090+ """
1091+ API endpoint for managing Banners displayed in the application.
1092+
1093+ retrieve:
1094+ Return the details of a specific Banner by ID.
1095+
1096+ list:
1097+ Return a list of all Banners.
1098+
1099+ create:
1100+ Create a new Banner. Requires admin or staff authentication.
1101+
1102+ update:
1103+ Update an existing Banner. Requires admin or staff authentication.
1104+
1105+ partial_update:
1106+ Partially update an existing Banner. Requires admin or staff authentication.
1107+
1108+ delete:
1109+ Delete a Banner. Requires admin or staff authentication.
1110+
1111+ Permissions:
1112+ - Only admin or staff users can create, update, or delete Banners.
1113+ - Read-only access for unauthenticated users (GET methods).
1114+ """
8871115 queryset = Banner .objects .all ()
8881116 serializer_class = BannerSerializer
8891117 authentication_classes = [OsmAuthentication ]
@@ -918,6 +1146,21 @@ def get_kpi_stats(request):
9181146
9191147
9201148class UserNotificationViewSet (ReadOnlyModelViewSet ):
1149+ """
1150+ API endpoint for retrieving user notifications.
1151+
1152+ list:
1153+ Return a list of notifications for the authenticated user. Supports filtering and ordering.
1154+
1155+ Filtering:
1156+ - is_read (exact match)
1157+
1158+ Ordering:
1159+ - created_at, read_at, is_read
1160+
1161+ Permissions:
1162+ - Only authenticated users can access their notifications.
1163+ """
9211164 authentication_classes = [OsmAuthentication ]
9221165 permission_classes = [IsOsmAuthenticated ]
9231166 serializer_class = UserNotificationSerializer
@@ -1074,6 +1317,34 @@ def create(self, validated_data):
10741317
10751318
10761319class PredictionViewSet (UserAssignmentMixin , viewsets .ModelViewSet ):
1320+ """
1321+ API endpoint for managing Predictions.
1322+
1323+ retrieve:
1324+ Return the details of a specific Prediction by ID.
1325+
1326+ list:
1327+ Return a list of all Predictions. Supports filtering, searching, and ordering.
1328+
1329+ create:
1330+ Create a new Prediction. Requires authentication.
1331+
1332+ partial_update:
1333+ Partially update an existing Prediction (only certain fields). Requires authentication and ownership.
1334+
1335+ Filtering:
1336+ - status, user, id (exact matches)
1337+
1338+ Searching:
1339+ - id
1340+
1341+ Ordering:
1342+ - created_at, id, status
1343+
1344+ Permissions:
1345+ - Only authenticated users can create or update Predictions.
1346+ - Read-only access for unauthenticated users (GET methods).
1347+ """
10771348 authentication_classes = [OsmAuthentication ]
10781349 permission_classes = [IsOsmAuthenticated , IsOwnerOrReadOnly ]
10791350 public_methods = ["GET" ]
0 commit comments