diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/__init__.py b/LCU/Maintenance/DBInterface/monitoringdb/models/__init__.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ee04345452a2bffc9923f4f9dfe45f6c53308d4a 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/__init__.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/__init__.py
@@ -0,0 +1,8 @@
+from .componenterror import *
+from .hbacomponenterror import *
+from .lbacomponenterror import *
+from .rcucomponenterror import *
+from .rspcomponenterror import *
+from .tbbcomponenterror import *
+from .spucomponenterror import *
+from .stationtest import *
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py
index fa1dc2ef931b01f449bdb0a68271cb21715472a3..95561ec135d4eb508159ce2a5415cae7d913bc48 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py
@@ -4,17 +4,15 @@ from polymorphic.models import PolymorphicModel
 from .stationtest import StationTest
 from .fixed_types import COMPONENT_TYPES, ERROR_TYPES
 
-
 NOISE_ERROR_TYPE = (('H', 'HIGH'), ('L', 'LOW'))
 
 
 class ComponentError(PolymorphicModel):
-
     id = models.AutoField(primary_key=True)
 
     component_id = models.IntegerField()
     component_type = models.CharField(max_length=6, choices=COMPONENT_TYPES)
     error_type = models.CharField(max_length=15, choices=ERROR_TYPES)
     parent = models.ForeignKey(StationTest,
-                                     related_name='all_errors',
-                                     on_delete=models.CASCADE)
\ No newline at end of file
+                               related_name='all_errors',
+                               on_delete=models.CASCADE)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py b/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
index 1b7f2479bbafcf83a298dc06f3105836f8ab8906..42aac70f56317080e6dd56bbb66955eea1dbaeaf 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
@@ -2,23 +2,32 @@ from .common import *
 from ..models.stationtest import StationTest
 from ..models.componenterror import ComponentError
 from ..models.tileerror import TileError
-from rest_framework.filters import SearchFilter
-
 from ..serializers.stationtest import StationTestSerializer
 from ..serializers.componenterrors_generic import ComponentErrorPolymorphicSerializer
-from ..serializers.tileerror import TileErrorPolymorphicSerializer
 
+from ..serializers.tileerror import TileErrorPolymorphicSerializer
+from rest_framework.serializers import Serializer
 from ..station_test_raw_parser import parse_raw_station_test
-
-
+import rest_framework.serializers as serializers
 from ..exceptions import ItemAlreadyExists
 
+import django.db.models.aggregates as aggregates
+
 logger = logging.getLogger('views')
 
 
-class ComponentErrorSummaryViewSet(viewsets.ModelViewSet):
-    queryset = ComponentError.objects.all()
-    serializer_class = ComponentErrorPolymorphicSerializer
+class ComponentErrorCountSummarySerializer(Serializer):
+    parent__station_name = serializers.CharField()
+    error_type = serializers.CharField()
+    component_type = serializers.CharField()
+    count = serializers.IntegerField()
+
+
+class ComponentErrorCountSummaryViewSet(viewsets.ModelViewSet):
+    queryset = ComponentError.objects.all().\
+        values('error_type', 'component_type', 'parent__station_name').\
+        annotate(count=aggregates.Count('error_type')).order_by('count')
+    serializer_class = ComponentErrorCountSummarySerializer
 
     def get_queryset(self):
         """
@@ -33,7 +42,10 @@ class ComponentErrorSummaryViewSet(viewsets.ModelViewSet):
             if key in RESERVED_FILTER_NAME:
                 continue
             queryset = queryset.filter(**{key: param})
-        return queryset
+            logger.info(queryset.values('parent__station_name','error_type', 'component_type'))
+        return queryset.\
+                values('error_type', 'component_type', 'parent__station_name').\
+                annotate(count=aggregates.Count('error_type')).order_by('count')
 
 # Create your views here.
 class StationTestViewSet(viewsets.ModelViewSet):