diff --git a/.gitattributes b/.gitattributes
index 0ad7a94294c38e4a56da9a4914e9dab978641038..d47f4241858699fa7e518b9aaa08b5b1f70d0a83 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1799,31 +1799,25 @@ LCU/Maintenance/DBInterface/monitoringdb/apps.py -text
 LCU/Maintenance/DBInterface/monitoringdb/exceptions.py -text
 LCU/Maintenance/DBInterface/monitoringdb/migrations/__init__.py -text
 LCU/Maintenance/DBInterface/monitoringdb/models/__init__.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/component.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/component_error.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/element.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/element_error.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/error_details.py -text
 LCU/Maintenance/DBInterface/monitoringdb/models/fixed_types.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/hbacomponenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/lbacomponenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/rcucomponenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/rspcomponenterror.py -text
 LCU/Maintenance/DBInterface/monitoringdb/models/rtsm.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/spucomponenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/stationtest.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/tbbcomponenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/models/tileerror.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/station.py -text
+LCU/Maintenance/DBInterface/monitoringdb/models/station_test.py -text
 LCU/Maintenance/DBInterface/monitoringdb/pagination.py -text
 LCU/Maintenance/DBInterface/monitoringdb/rtsm_test_raw_parser.py -text
 LCU/Maintenance/DBInterface/monitoringdb/serializers/__init__.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterror.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterrors_generic.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/hbaerrorserializers.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/lbaerrorserializer.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/rcuerrorserializer.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/rsperrorserializer.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/rtsm.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/spuerrorserializer.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/stationtest.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/tbberrorserializer.py -text
-LCU/Maintenance/DBInterface/monitoringdb/serializers/tileerror.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/component.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/component_error.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/element.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/element_error.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/error_details.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/station.py -text
+LCU/Maintenance/DBInterface/monitoringdb/serializers/station_tests.py -text
 LCU/Maintenance/DBInterface/monitoringdb/station_test_raw_parser.py -text
 LCU/Maintenance/DBInterface/monitoringdb/tests/__init__.py -text
 LCU/Maintenance/DBInterface/monitoringdb/tests/common.py -text
diff --git a/LCU/Maintenance/DBInterface/django_postgresql/settings.py b/LCU/Maintenance/DBInterface/django_postgresql/settings.py
index e08465f09301f5f2a5c4f3e884d3c739e3f71aba..d067939c84501ff4384a976a1a3c4eeb9134447c 100644
--- a/LCU/Maintenance/DBInterface/django_postgresql/settings.py
+++ b/LCU/Maintenance/DBInterface/django_postgresql/settings.py
@@ -11,7 +11,6 @@ https://docs.djangoproject.com/en/2.0/ref/settings/
 """
 
 import os
-import mongoengine
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
@@ -24,7 +23,7 @@ SECRET_KEY = 'x)5=9*2a&)32h-loh@rlt_9eyw%t$-fqao*#1j2gh^7=^bnjyy'
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
 
-ALLOWED_HOSTS = ['lofarmonitortest.control.lofar', 'localhost']
+ALLOWED_HOSTS = ['lofarmonitortest.control.lofar', 'localhost', '127.0.0.1']
 
 
 # Application definition
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/component.py b/LCU/Maintenance/DBInterface/monitoringdb/models/component.py
new file mode 100644
index 0000000000000000000000000000000000000000..2882a9a203698d43c3fffc9b1eb1dadc71af9bae
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/component.py
@@ -0,0 +1,8 @@
+from django.db import models
+from .station import Station
+
+
+class Component(models.Model):
+    type = models.CharField(max_length=50)
+    component_id = models.IntegerField()
+    station = models.ForeignKey(Station, on_delete=models.DO_NOTHING)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/component_error.py b/LCU/Maintenance/DBInterface/monitoringdb/models/component_error.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab5903e2a8ce3edb7c47e7b91ecd64852dc1e344
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/component_error.py
@@ -0,0 +1,14 @@
+from django.db import models
+from .component import Component
+from .station_test import StationTest
+from .error_details import ErrorDetails
+
+
+class ComponentError(models.Model):
+    type = models.CharField(max_length=50)
+    component = models.ForeignKey(Component, on_delete=models.DO_NOTHING)
+    station_test = models.ForeignKey(StationTest, on_delete=models.DO_NOTHING)
+    details = models.ForeignKey(ErrorDetails,
+                                on_delete=models.CASCADE,
+                                related_name='details',
+                                null=True)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py
deleted file mode 100644
index 95561ec135d4eb508159ce2a5415cae7d913bc48..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/componenterror.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from django.db import models
-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)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/element.py b/LCU/Maintenance/DBInterface/monitoringdb/models/element.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0ce9e9b57cd68a14e77a8dd774dcf0629f9ae2e
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/element.py
@@ -0,0 +1,7 @@
+from django.db import models
+from .component import Component
+
+
+class Element(models.Model):
+    component = models.ForeignKey(Component, on_delete=models.DO_NOTHING)
+    element_id = models.PositiveIntegerField()
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/element_error.py b/LCU/Maintenance/DBInterface/monitoringdb/models/element_error.py
new file mode 100644
index 0000000000000000000000000000000000000000..96658b5ebea0983009b42b4736dff107e778cf2b
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/element_error.py
@@ -0,0 +1,16 @@
+from django.db import models
+from .element import Element
+from .error_details import ErrorDetails
+from .station_test import StationTest
+from .component_error import ComponentError
+
+
+class ElementError(models.Model):
+    element = models.ForeignKey(Element, on_delete=models.DO_NOTHING)
+    component_error = models.ForeignKey(ComponentError,
+                                        on_delete=models.DO_NOTHING,
+                                        related_name='elements')
+    station_test = models.ForeignKey(StationTest, on_delete=models.DO_NOTHING)
+
+    type = models.CharField(max_length=50)
+    details = models.ForeignKey(ErrorDetails, on_delete=models.CASCADE)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/error_details.py b/LCU/Maintenance/DBInterface/monitoringdb/models/error_details.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8a9c0a83f067fdaf1673ddc2cabb59b1c86fc6d
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/error_details.py
@@ -0,0 +1,42 @@
+from django.db import models
+
+
+class ErrorDetails(models.Model):
+    x = models.BooleanField(default=None, null=True)
+    y = models.BooleanField(default=None, null=True)
+
+    xval = models.FloatField(default=None, null=True)
+    yval = models.FloatField(default=None, null=True)
+
+    xoffset = models.FloatField(default=None, null=True)
+    yoffset = models.FloatField(default=None, null=True)
+
+    xval_no_delay = models.FloatField(default=None, null=True)
+    yval_no_delay = models.FloatField(default=None, null=True)
+
+    xsb_no_delay = models.FloatField(default=None, null=True)
+    ysb_no_delay = models.FloatField(default=None, null=True)
+
+    xref_no_delay = models.FloatField(default=None, null=True)
+    yref_no_delay = models.FloatField(default=None, null=True)
+
+    xref = models.FloatField(default=None, null=True)
+    yref = models.FloatField(default=None, null=True)
+
+    xsb_full_delay = models.FloatField(default=None, null=True)
+    ysb_full_delay = models.FloatField(default=None, null=True)
+
+    xref_full_delay = models.FloatField(default=None, null=True)
+    yref_full_delay = models.FloatField(default=None, null=True)
+
+    xval_full_delay = models.FloatField(default=None, null=True)
+    yval_full_delay = models.FloatField(default=None, null=True)
+
+    xlimit = models.FloatField(default=None, null=True)
+    ylimit = models.FloatField(default=None, null=True)
+
+    xproc = models.FloatField(default=None, null=True)
+    yproc = models.FloatField(default=None, null=True)
+
+    xdiff = models.FloatField(default=None, null=True)
+    ydiff = models.FloatField(default=None, null=True)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/hbacomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/hbacomponenterror.py
deleted file mode 100644
index ffc17f2bdcadae0513381c18bbd2be06b6e00587..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/hbacomponenterror.py
+++ /dev/null
@@ -1,81 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError, NOISE_ERROR_TYPE
-
-
-class HBAComponentError(ComponentError):
-    pass
-
-
-HBA_SUMMATOR_ERROR_TYPE = (('C',''), ('P',''))
-
-
-class HBASummatorError(HBAComponentError):
-    type = models.CharField(choices=HBA_SUMMATOR_ERROR_TYPE, max_length=1)
-
-
-class HBAModemError(HBAComponentError):
-    pass
-
-
-class HBARFFailError(HBAComponentError):
-
-    measured_signal_nodelayX = models.FloatField(null=True, default=None)
-    measured_signal_fulldelayX = models.FloatField(null=True, default=None)
-
-    subband_used_nodelayX = models.PositiveSmallIntegerField(null=True,default=None)
-    subband_used_fulldelayX = models.PositiveSmallIntegerField(null=True,default=None)
-
-    reference_signal_nodelayX = models.FloatField(null=True,default=None)
-    reference_signal_fulldelayX = models.FloatField(null=True,default=None)
-
-    measured_signal_nodelayY = models.FloatField(default=None, null=True)
-    measured_signal_fulldelayY = models.FloatField(default=None, null=True)
-
-    subband_used_nodelayY = models.PositiveSmallIntegerField(default=None, null=True)
-    subband_used_fulldelayY = models.PositiveSmallIntegerField(default=None, null=True)
-
-    reference_signal_nodelayY = models.FloatField(default=None, null=True)
-    reference_signal_fulldelayY = models.FloatField(default=None, null=True)
-
-
-class HBANoiseError(HBAComponentError):
-    type = models.CharField(default='-', max_length=1, choices=NOISE_ERROR_TYPE)
-
-    percentageX = models.FloatField(default=None, null=True)
-    percentageY = models.FloatField(default=None, null=True)
-
-    peak_valueX = models.FloatField(default=None, null=True)
-    peak_valueY = models.FloatField(default=None, null=True)
-
-    fluctuationX = models.FloatField(default=None, null=True)
-    fluctuationY = models.FloatField(default=None, null=True)
-
-    limitX = models.FloatField(default=None, null=True)
-    limitY = models.FloatField(default=None, null=True)
-
-
-class HBAJitterError(HBAComponentError):
-    percentageX = models.FloatField(default=None, null=True)
-    percentageY = models.FloatField(default=None, null=True)
-
-    average_valueX = models.FloatField(default=None, null=True)
-    average_valueY = models.FloatField(default=None, null=True)
-
-    fluctuationX = models.FloatField(default=None, null=True)
-    fluctuationY = models.FloatField(default=None, null=True)
-
-
-class HBAOscillationError(HBAComponentError):
-    polarizationX = models.BooleanField(default=False)
-    polarizationY = models.BooleanField(default=False)
-
-
-class HBASpuriousError(HBAComponentError):
-    polarizationX = models.BooleanField(default=False)
-    polarizationY = models.BooleanField(default=False)
-
-
-class HBASummatorNoise(HBAComponentError):
-    polarizationX = models.BooleanField(default=False)
-    polarizationY = models.BooleanField(default=False)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/lbacomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/lbacomponenterror.py
deleted file mode 100644
index 3026a489afbd79c6ba9dc843f84d8809a34828d0..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/lbacomponenterror.py
+++ /dev/null
@@ -1,67 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError, NOISE_ERROR_TYPE
-from .stationtest import StationTest
-
-
-class LBAComponentError(ComponentError):
-    lba_type = models.CharField(max_length=1)
-
-
-class LBADownError(LBAComponentError):
-    signalX = models.FloatField(default=None, null=True)
-    signalY = models.FloatField(default=None, null=True)
-    signalX_offset = models.FloatField(default=None, null=True)
-    signalY_offset = models.FloatField(default=None, null=True)
-
-
-class LBARFFailError(LBAComponentError):
-    signalX = models.FloatField(default=None, null=True)
-    signalY = models.FloatField(default=None, null=True)
-
-
-class LBAFlatError(LBAComponentError):
-    mean_signalX = models.FloatField(default=None, null=True)
-    mean_signalY = models.FloatField(default=None, null=True)
-
-
-class LBAShortError(LBAComponentError):
-    mean_signalX = models.FloatField(default=None, null=True)
-    mean_signalY = models.FloatField(default=None, null=True)
-
-
-class LBAOscillationError(LBAComponentError):
-    polarizationX = models.BooleanField(default=False)
-    polarizationY = models.BooleanField(default=False)
-
-
-class LBASpuriousError(LBAComponentError):
-    polarizationX = models.BooleanField(default=False)
-    polarizationY = models.BooleanField(default=False)
-
-
-class LBANoiseError(LBAComponentError):
-    type = models.CharField(default='-', max_length=1, choices=NOISE_ERROR_TYPE)
-
-    percentageX = models.FloatField(default=None, null=True)
-    percentageY = models.FloatField(default=None, null=True)
-
-    peak_valueX = models.FloatField(default=None, null=True)
-    peak_valueY = models.FloatField(default=None, null=True)
-
-    fluctuationX = models.FloatField(default=None, null=True)
-    fluctuationY = models.FloatField(default=None, null=True)
-
-    limitX = models.FloatField(default=None, null=True)
-    limitY = models.FloatField(default=None, null=True)
-
-
-class LBAJitterError(LBAComponentError):
-    percentageX = models.FloatField(default=None, null=True)
-    percentageY = models.FloatField(default=None, null=True)
-
-    average_valueX = models.FloatField(default=None, null=True)
-    average_valueY = models.FloatField(default=None, null=True)
-
-    fluctuationX = models.FloatField(default=None, null=True)
-    fluctuationY = models.FloatField(default=None, null=True)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/rcucomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/rcucomponenterror.py
deleted file mode 100644
index c6b9a0db87338276b244b1c48868a024d907e3f8..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/rcucomponenterror.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError
-from .stationtest import StationTest
-
-
-class RCUComponentError(ComponentError):
-    pass
-
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/rspcomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/rspcomponenterror.py
deleted file mode 100644
index f9563c8264d9d28fc3645e31210c8b16f6217549..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/rspcomponenterror.py
+++ /dev/null
@@ -1,28 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError
-from .stationtest import StationTest
-
-
-class RSPComponentError(ComponentError):
-    pass
-
-
-class RSPVersionError(RSPComponentError):
-    BP = models.CharField(max_length=10)
-    AP = models.CharField(max_length=10)
-
-
-class RSPVoltageError(RSPComponentError):
-    voltage_1_2 = models.FloatField(default=None, null=True)
-    voltage_2_5 = models.FloatField(default=None, null=True)
-    voltage_3_3 = models.FloatField(default=None, null=True)
-
-
-class RSPTemperatureError(RSPComponentError):
-    pcb = models.FloatField(default=None, null=True)
-    bp = models.FloatField(default=None, null=True)
-    ap0 = models.FloatField(default=None, null=True)
-    ap1 = models.FloatField(default=None, null=True)
-    ap2 = models.FloatField(default=None, null=True)
-    ap3 = models.FloatField(default=None, null=True)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/spucomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/spucomponenterror.py
deleted file mode 100644
index a29472d793233311e5d8905203164e7f4bd15d4b..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/spucomponenterror.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError
-from .stationtest import StationTest
-
-
-class SPUComponentError(ComponentError):
-    pass
-
-
-class SPUVoltageError(SPUComponentError):
-    voltage_rcu = models.FloatField(default=5)
-    voltage_lba = models.FloatField(default=8)
-    voltage_hba = models.FloatField(default=48)
-    voltage_spu = models.FloatField(default=3.3)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/station.py b/LCU/Maintenance/DBInterface/monitoringdb/models/station.py
new file mode 100644
index 0000000000000000000000000000000000000000..ec6eaa599dfdf63ac3cd0588ddfa12a39855c403
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/station.py
@@ -0,0 +1,8 @@
+from django.db import models
+from .fixed_types import STATION_TYPES
+
+
+class Station(models.Model):
+    location = models.CharField(max_length=50, null=True, blank=True)
+    name = models.CharField(max_length=10)
+    type = models.CharField(max_length=1, choices=STATION_TYPES)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/station_test.py b/LCU/Maintenance/DBInterface/monitoringdb/models/station_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..b915ad512c0cd0973e9ea1b9cc8a805b62c0a33e
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/models/station_test.py
@@ -0,0 +1,9 @@
+from django.db import models
+from .station import Station
+
+
+class StationTest(models.Model):
+    start_datetime = models.DateTimeField()
+    end_datetime = models.DateTimeField()
+    checks = models.CharField(max_length=2000)
+    station = models.ForeignKey(Station, on_delete=models.DO_NOTHING)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/stationtest.py b/LCU/Maintenance/DBInterface/monitoringdb/models/stationtest.py
deleted file mode 100644
index 59999623ee81e4eaf17fd3900a7ab11e69a22093..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/stationtest.py
+++ /dev/null
@@ -1,21 +0,0 @@
-"""
-In this file all the model regarding the stationtest output are collected
-"""
-from django.db import models
-
-from .fixed_types import STATION_TYPES
-
-
-class StationTest(models.Model):
-
-    id = models.AutoField(primary_key=True)
-
-    station_name = models.CharField(max_length=6)
-    station_type = models.CharField(max_length=1, choices=STATION_TYPES)
-
-    start_time = models.DateTimeField()
-    end_time = models.DateTimeField()
-
-    performed_checks = models.CharField(max_length=1024)
-
-
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/tbbcomponenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/tbbcomponenterror.py
deleted file mode 100644
index f3d810107aa6a401bceb4179537ff9d7f1ecad20..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/tbbcomponenterror.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from django.db import models
-
-from .componenterror import ComponentError
-from .stationtest import StationTest
-
-
-class TBBComponentError(ComponentError):
-    pass
-
-
-class TBBVersionError(TBBComponentError):
-    TP = models.CharField(max_length=10)
-    MP = models.CharField(max_length=10)
-
-
-class TBBMemoryError(TBBComponentError):
-    pass
-
-
-class TBBVoltageError(TBBComponentError):
-    voltage_1_2 = models.FloatField(default=None, null=True)
-    voltage_2_5 = models.FloatField(default=None, null=True)
-    voltage_3_3 = models.FloatField(default=None, null=True)
-
-
-class TBBTemperatureError(TBBComponentError):
-    pcb = models.FloatField(default=None, null=True)
-    tp = models.FloatField(default=None, null=True)
-    mp0 = models.FloatField(default=None, null=True)
-    mp1 = models.FloatField(default=None, null=True)
-    mp2 = models.FloatField(default=None, null=True)
-    mp3 = models.FloatField(default=None, null=True)
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/models/tileerror.py b/LCU/Maintenance/DBInterface/monitoringdb/models/tileerror.py
deleted file mode 100644
index 7808bd97e554702a0514740760cf19744f9b7906..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/models/tileerror.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from django.db import models
-from polymorphic.models import PolymorphicModel
-
-from .hbacomponenterror import *
-
-
-class TileError(PolymorphicModel):
-    id = models.AutoField(primary_key=True)
-    tile_id = models.SmallIntegerField(default=-1)
-    parent_component_error = models.ForeignKey(HBAComponentError,
-                                               related_name='tile_errors',
-                                               on_delete=models.CASCADE)
-
-
-class TileModemError(TileError):
-    communication_error = models.BooleanField(default=False)
-    wrong_answer_error = models.BooleanField(default=False)
-
-
-class TileOscillatingError(TileError):
-    polarization = models.CharField(max_length=1)
-
-
-class TileSpuriousError(TileError):
-    polarization = models.CharField(max_length=1)
-
-
-class TileNoiseError(TileError):
-
-    polarization = models.CharField(max_length=1)
-    type = models.CharField(max_length=1)
-    # measured (lowest) highest mean value over all subbands
-    value = models.FloatField()
-    # difference between lowest and highest found mean values
-    diff = models.FloatField()
-
-
-class TileJitterError(TileError):
-    polarization = models.CharField(max_length=1)
-    fluctuation = models.FloatField()
-
-
-class TileRFFailure(TileError):
-    polarization = models.CharField(max_length=1)
-    measured_signal_nodelay = models.FloatField()
-    measured_signal_fulldelay = models.FloatField()
-    subband_used_nodelay = models.PositiveSmallIntegerField()
-    subband_used_fulldelay = models.PositiveSmallIntegerField()
-    reference_signal_nodelay = models.FloatField()
-    reference_signal_fulldelay = models.FloatField()
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/component.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/component.py
new file mode 100644
index 0000000000000000000000000000000000000000..836b28f3fe44f6407c2a2b5a67a1750afb9eb445
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/component.py
@@ -0,0 +1,7 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.component import Component
+
+class ComponentSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = Component
+        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/component_error.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/component_error.py
new file mode 100644
index 0000000000000000000000000000000000000000..db3d12aa12a9d3b18189d5d14b792f5babfaee08
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/component_error.py
@@ -0,0 +1,7 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.component_error import ComponentError, Component
+
+class ComponentErrorSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = ComponentError
+        fields = '__all__'
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterror.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterror.py
deleted file mode 100644
index 5cfd259cf1fed10d310f8b8e430c567aed1dfdf3..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterror.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from rest_framework import serializers
-
-from ..models.fixed_types import COMPONENT_TYPES, ERROR_TYPES
-from ..models.stationtest import StationTest
-from ..models.componenterror import ComponentError
-
-
-class ComponentErrorSerializer(serializers.ModelSerializer):
-    id = serializers.IntegerField(read_only=True)
-    station_test_id = serializers.PrimaryKeyRelatedField(queryset=StationTest.objects.all(), source='parent.id')
-
-    component_id = serializers.IntegerField()
-    component_type = serializers.ChoiceField(COMPONENT_TYPES)
-    error_type = serializers.ChoiceField(ERROR_TYPES)
-
-    class Meta:
-        model = ComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        """
-        Create the component error given the fields
-        """
-
-        return ComponentError(**validated_data)
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterrors_generic.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterrors_generic.py
deleted file mode 100644
index 072fe8646f79601f81428aeac1f1c932fb698f84..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/componenterrors_generic.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from .hbaerrorserializers import *
-from .lbaerrorserializer import *
-from .rcuerrorserializer import *
-from .rsperrorserializer import *
-from .tbberrorserializer import *
-from .spuerrorserializer import *
-
-
-class ComponentErrorPolymorphicSerializer(PolymorphicSerializer):
-    model_serializer_mapping = {
-        ComponentError: ComponentErrorSerializer,
-        HBAComponentError: HBAComponentErrorSerializer,
-        HBASummatorNoise: HBASummatorNoiseSerializer,
-        HBASummatorError: HBASummatorErrorSerializer,
-        HBAOscillationError: HBAOscillationErrorSerializer,
-        HBAModemError: HBAModemErrorSerializer,
-        HBANoiseError: HBANoiseSerializer,
-        HBAJitterError: HBAJitterSerializer,
-        HBASpuriousError: HBASpuriousSerializer,
-        HBARFFailError: HBARFFailSerializer,
-
-        LBAComponentError: LBAComponentErrorSerializer,
-        LBAOscillationError: LBAOscillationSerializer,
-        LBANoiseError: LBANoiseSerializer,
-        LBAJitterError: LBAJitterSerializer,
-        LBASpuriousError: LBASpuriousSerializer,
-        LBARFFailError: LBARFFailSerializer,
-        LBADownError: LBADownErrorSerializer,
-        LBAShortError: LBAShortErrorSerializer,
-        LBAFlatError: LBAFlatErrorSerializer,
-
-        RCUComponentError: RCUComponentErrorSerializer,
-
-        RSPComponentError: RSPComponentErrorSerializer,
-        RSPTemperatureError: RSPTemperatureErrorSerializer,
-        RSPVoltageError: RSPVoltageErrorSerializer,
-        RSPVersionError: RSPVersionErrorSerializer,
-
-        TBBComponentError: TBBComponentErrorSerializer,
-        TBBMemoryError: TBBMemoryErrorSerializer,
-        TBBVoltageError: TBBVoltageErrorSerializer,
-        TBBVersionError: TBBVersionErrorSerializer,
-        TBBTemperatureError: TBBTemperatureErrorSerializer,
-
-        SPUComponentError: SPUComponentErrorSerializer,
-        SPUVoltageError: SPUVoltageErrorSerializer
-    }
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/element.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/element.py
new file mode 100644
index 0000000000000000000000000000000000000000..27b3bee6931385fce9bd67ca16f390a2e31a57b9
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/element.py
@@ -0,0 +1,8 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.element import Element
+
+
+class ElementSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = Element
+        fields = '__all__'
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/element_error.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/element_error.py
new file mode 100644
index 0000000000000000000000000000000000000000..36873a66b36c99362132f548257cd275bc97c128
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/element_error.py
@@ -0,0 +1,8 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.element_error import ElementError
+
+
+class ElementErrorSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = ElementError
+        fields = '__all__'
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/error_details.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/error_details.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c8db3cf1fcba61b89d7870526ac6b1e3b8e459a
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/error_details.py
@@ -0,0 +1,7 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.error_details import ErrorDetails
+
+class ErrorDetailsSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = ErrorDetails
+        fields = '__all__'
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/hbaerrorserializers.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/hbaerrorserializers.py
deleted file mode 100644
index 74f321302cec3c4eb8b4e9210861c540d5223b2d..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/hbaerrorserializers.py
+++ /dev/null
@@ -1,103 +0,0 @@
-
-from ..models.tileerror import *
-from .tileerror import *
-from .componenterror import ComponentErrorSerializer
-from django.db.transaction import atomic
-import logging
-
-logger = logging.getLogger(__name__)
-
-class HBAComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = HBAComponentError
-        fields = '__all__'
-
-    @atomic
-    def create(self, validated_data):
-        tile_errors_data = validated_data.pop('tile_errors')
-        try:
-            hba_component_error_instance = self.Meta.model.objects.create(**validated_data)
-        except Exception as e:
-            logger.exception("data %s malformed to create HBA component error" % (validated_data,))
-            raise e
-
-        for tile_error in tile_errors_data:
-            tile_error['parent_component_error'] = hba_component_error_instance
-            tile_instance = TileErrorPolymorphicSerializer().create(tile_error)
-            tile_instance.save()
-
-        return hba_component_error_instance
-
-
-# Note that the summator error and noise doesnt have the information about the tiles. Hence, it override the create
-# function of the parent class
-class HBASummatorErrorSerializer(HBAComponentErrorSerializer):
-    class Meta:
-        model = HBASummatorError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        if 'tile_errors' in validated_data:
-            validated_data.pop('tile_errors')
-        return HBASummatorError.objects.create(**validated_data)
-
-
-# Note that the summator error and noise doesnt have the information about the tiles. Hence, it override the create
-# function of the parent class
-class HBASummatorNoiseSerializer(HBAComponentErrorSerializer):
-    class Meta:
-        model = HBASummatorNoise
-        fields = '__all__'
-
-    def create(self, validated_data):
-        if 'tile_errors' in validated_data:
-            validated_data.pop('tile_errors')
-        return HBASummatorNoise.objects.create(**validated_data)
-
-
-class HBAModemErrorSerializer(HBAComponentErrorSerializer):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBAModemError
-        fields = '__all__'
-
-
-class HBANoiseSerializer(HBAComponentErrorSerializer):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBANoiseError
-        fields = '__all__'
-
-
-class HBAJitterSerializer(HBAComponentErrorSerializer):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBAJitterError
-        fields = '__all__'
-
-
-class HBAOscillationErrorSerializer(HBAComponentErrorSerializer ):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBAOscillationError
-        fields = '__all__'
-
-
-class HBASpuriousSerializer(HBAComponentErrorSerializer):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBASpuriousError
-        fields = '__all__'
-
-
-class HBARFFailSerializer(HBAComponentErrorSerializer):
-    tile_errors = TileErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = HBARFFailError
-        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/lbaerrorserializer.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/lbaerrorserializer.py
deleted file mode 100644
index b7c95383cc97a650e6629a8570cec95e5c1b067f..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/lbaerrorserializer.py
+++ /dev/null
@@ -1,84 +0,0 @@
-from ..models.lbacomponenterror import *
-from .componenterror import ComponentErrorSerializer
-
-class LBAComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = LBAComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBAComponentError.objects.create(**validated_data)
-
-
-class LBADownErrorSerializer(LBAComponentErrorSerializer):
-    class Meta(LBAComponentErrorSerializer.Meta):
-        model = LBADownError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBADownError.objects.create(**validated_data)
-
-
-class LBARFFailSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBARFFailError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBARFFailError.objects.create(**validated_data)
-
-
-class LBAFlatErrorSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBAFlatError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBAFlatError.objects.create(**validated_data)
-
-
-class LBAShortErrorSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBAShortError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBAShortError.objects.create(**validated_data)
-
-
-class LBAOscillationSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBAOscillationError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBAOscillationError.objects.create(**validated_data)
-
-
-class LBASpuriousSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBASpuriousError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBASpuriousError.objects.create(**validated_data)
-
-
-class LBANoiseSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBANoiseError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBANoiseError.objects.create(**validated_data)
-
-
-class LBAJitterSerializer(LBAComponentErrorSerializer):
-    class Meta:
-        model = LBAJitterError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return LBAJitterError.objects.create(**validated_data)
-
-
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rcuerrorserializer.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/rcuerrorserializer.py
deleted file mode 100644
index f4c6566ac5a5f3ff294941e17e6fd7e5430ec14a..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rcuerrorserializer.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from ..models.rcucomponenterror import *
-from .componenterror import ComponentErrorSerializer
-
-
-class RCUComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = RCUComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        instance = self.Meta.models.objects.create(**validated_data)
-        return instance
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rsperrorserializer.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/rsperrorserializer.py
deleted file mode 100644
index 71c02f544ea1e5f96884385a005b98ec4f9bf66c..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rsperrorserializer.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from ..models.rspcomponenterror import *
-from .componenterror import ComponentErrorSerializer
-
-
-class RSPComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = RSPComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        instance = self.Meta.model.objects.create(**validated_data)
-        return instance
-
-
-class RSPVersionErrorSerializer(RSPComponentErrorSerializer):
-    class Meta:
-        model = RSPVersionError
-        fields = '__all__'
-
-
-class RSPVoltageErrorSerializer(RSPComponentErrorSerializer):
-    class Meta:
-        model = RSPVoltageError
-        fields = '__all__'
-
-
-class RSPTemperatureErrorSerializer(RSPComponentErrorSerializer):
-    class Meta:
-        model = RSPTemperatureError
-        fields = '__all__'
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rtsm.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/rtsm.py
deleted file mode 100644
index b26d5eef29363a01421349f1dc546f4a2ba33191..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/rtsm.py
+++ /dev/null
@@ -1,80 +0,0 @@
-from ..models.rtsm import *
-from rest_framework import serializers
-import logging
-from django.db.transaction import atomic
-from ..exceptions import ItemAlreadyExists
-from django.db.models import ObjectDoesNotExist
-
-logger = logging.getLogger('serializers')
-
-
-class RTSMErrorsAggregateSerializer(serializers.Serializer):
-    count = serializers.IntegerField()
-    percentage = serializers.FloatField()
-    error_type = serializers.CharField()
-    rcu = serializers.IntegerField()
-
-
-class RTSMErrorSerializer(serializers.ModelSerializer):
-    bad_spectrum = serializers.ListField(child=serializers.FloatField())
-    average_spectrum = serializers.ListField(child=serializers.FloatField())
-
-    class Meta:
-        model = RTSMError
-        fields = '__all__'
-
-
-class RTSMErrorSummarySerializer(serializers.ModelSerializer):
-    samples = serializers.IntegerField(source='observation.samples', read_only=True)
-    start_time = serializers.DateTimeField(source='observation.start_time', read_only=True)
-    end_time = serializers.DateTimeField(source='observation.start_time', read_only=True)
-    observation_id = serializers.IntegerField(source='observation.observation_id', read_only=True)
-    id = serializers.IntegerField()
-
-    class Meta:
-        model = RTSMErrorSummary
-        fields = '__all__'
-
-
-class RTSMObservationSummarySerializer(serializers.ModelSerializer):
-    errors_found = RTSMErrorsAggregateSerializer(many=True)
-
-    class Meta:
-        model = RTSMObservationSummary
-        fields = '__all__'
-
-
-class RTSMObservationSerializer(serializers.ModelSerializer):
-    errors_summary = RTSMErrorSummarySerializer(many=True)
-
-    class Meta:
-        model = RTSMObservation
-        fields = '__all__'
-
-    @atomic
-    def create(self, validated_data):
-        rtsm_errors = validated_data.pop('errors')
-        try:
-            start_time, station_name = validated_data['start_time'], validated_data['station_name']
-            station_type = station_name[0].capitalize()
-            station_type = station_type if station_type in ['C', 'R'] else 'I'
-            validated_data.update(station_type=station_type)
-            element = RTSMObservation.objects.filter(start_time=start_time,
-                                                     station_name=station_name).first()
-
-            if element is None:
-                logger.info('rtsm not found inserting %s', validated_data)
-            else:
-                logger.info('RTSM test for station %s started at %s is present already. Skipping insertion',
-                            start_time, station_name)
-                raise ItemAlreadyExists(element)
-        except ObjectDoesNotExist as e:
-            logger.info('rtsm not found inserting %s', validated_data)
-        RTSMObservation_instance = RTSMObservation.objects.create(**validated_data)
-        RTSMObservation_instance.save()
-        for rtsm_error in rtsm_errors:
-            rtsm_error.update(observation=RTSMObservation_instance)
-            rtsm_error_instance = RTSMError.objects.create(**rtsm_error)
-            rtsm_error_instance.save()
-
-        return RTSMObservation_instance
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/spuerrorserializer.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/spuerrorserializer.py
deleted file mode 100644
index de7f709e4b137c7a52aabc015cf642c4dbca96c9..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/spuerrorserializer.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from ..models.spucomponenterror import *
-from .componenterror import ComponentErrorSerializer
-
-
-class SPUComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = SPUComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        instance = self.Meta.model.objects.create(**validated_data)
-        return instance
-
-
-class SPUVoltageErrorSerializer(SPUComponentErrorSerializer):
-    class Meta:
-        model = SPUVoltageError
-        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/station.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/station.py
new file mode 100644
index 0000000000000000000000000000000000000000..6d6965baa5dc6f5a54902198c6fb6c1940c30654
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/station.py
@@ -0,0 +1,7 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+from ..models.station import Station
+
+class StationSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = Station
+        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/station_tests.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/station_tests.py
new file mode 100644
index 0000000000000000000000000000000000000000..155348b7f16f15fc037e65a9f428b338957f7141
--- /dev/null
+++ b/LCU/Maintenance/DBInterface/monitoringdb/serializers/station_tests.py
@@ -0,0 +1,7 @@
+from rest_framework.serializers import HyperlinkedModelSerializer
+
+
+class StationTestSerializer(HyperlinkedModelSerializer):
+    class Meta:
+        model = 'StationTest'
+        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/stationtest.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/stationtest.py
deleted file mode 100644
index 2f7e0077f3a4c1dd76219c2b4b01f55bb8c76782..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/stationtest.py
+++ /dev/null
@@ -1,65 +0,0 @@
-from ..models.stationtest import *
-from rest_framework import serializers
-from django.db.models import ObjectDoesNotExist
-from django.db.transaction import atomic
-import logging
-from .componenterrors_generic import ComponentErrorPolymorphicSerializer
-
-from ..exceptions import ItemAlreadyExists
-
-logger = logging.getLogger('serializers')
-
-
-class StationTestSerializer(serializers.ModelSerializer):
-    all_errors = ComponentErrorPolymorphicSerializer(many=True)
-
-    class Meta:
-        model = StationTest
-        fields = '__all__'
-
-    @atomic
-    def create(self, validated_data):
-        if 'components_error' in validated_data:
-            component_error_data = validated_data.pop('components_error')
-
-        else:
-            hba_errors_data = validated_data.pop('hba_errors')
-            lba_errors_data = validated_data.pop('lba_errors')
-            rcu_errors_data = validated_data.pop('rcu_errors')
-            rsp_errors_data = validated_data.pop('rsp_errors')
-            spu_errors_data = validated_data.pop('spu_errors')
-            tbb_errors_data = validated_data.pop('tbb_errors')
-
-            component_error_data = hba_errors_data+\
-                                   lba_errors_data+\
-                                   rcu_errors_data+\
-                                   rsp_errors_data+\
-                                   spu_errors_data+\
-                                   tbb_errors_data
-
-        try:
-            start_time, station_name = validated_data['start_time'], validated_data['station_name']
-
-            element = StationTest.objects.filter(start_time=start_time,
-                                                 station_name=station_name).first()
-
-            if element is not None:
-                logger.info('Station test for station %s started at %s is present already. Skipping insertion',
-                        start_time, station_name)
-
-                logger.debug('found item is %s', element)
-                raise ItemAlreadyExists(element)
-            else:
-                logger.info('station test not found inserting %s', validated_data)
-        except ObjectDoesNotExist:
-            logger.info('station test not found inserting %s', validated_data)
-
-        station_test_instance = StationTest.objects.create(**validated_data)
-        station_test_instance.save()
-
-        for component_error in component_error_data:
-            component_error['parent'] = station_test_instance
-            component_error_instance = ComponentErrorPolymorphicSerializer().create(component_error)
-            component_error_instance.save()
-
-        return station_test_instance
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/tbberrorserializer.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/tbberrorserializer.py
deleted file mode 100644
index 94cbad2c5d548f74ff42b01f90b6b124b566e2b0..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/tbberrorserializer.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from ..models.tbbcomponenterror import *
-from .componenterror import ComponentErrorSerializer
-
-
-class TBBComponentErrorSerializer(ComponentErrorSerializer):
-    class Meta:
-        model = TBBComponentError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        instance = self.Meta.model.objects.create(**validated_data)
-        return instance
-
-
-class TBBVersionErrorSerializer(TBBComponentErrorSerializer):
-    class Meta:
-        model = TBBVersionError
-        fields = '__all__'
-
-
-class TBBMemoryErrorSerializer(TBBComponentErrorSerializer):
-    class Meta:
-        model = TBBMemoryError
-        fields = '__all__'
-
-
-class TBBVoltageErrorSerializer(TBBComponentErrorSerializer):
-    class Meta:
-        model = TBBVoltageError
-        fields = '__all__'
-
-
-class TBBTemperatureErrorSerializer(TBBComponentErrorSerializer):
-    class Meta:
-        model = TBBTemperatureError
-        fields = '__all__'
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/serializers/tileerror.py b/LCU/Maintenance/DBInterface/monitoringdb/serializers/tileerror.py
deleted file mode 100644
index c47609feec123ff17a4b933a13211f75fb8c1afb..0000000000000000000000000000000000000000
--- a/LCU/Maintenance/DBInterface/monitoringdb/serializers/tileerror.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from rest_framework import serializers
-from rest_polymorphic.serializers import PolymorphicSerializer
-
-from ..models.tileerror import TileError, TileJitterError, \
-    TileNoiseError, TileModemError, TileOscillatingError, TileSpuriousError, TileRFFailure
-
-
-class TileErrorSerializer(serializers.ModelSerializer):
-    class Meta:
-        model = TileError
-        fields = '__all__'
-
-    def create(self, validated_data):
-        return self.Meta.model(**validated_data)
-
-
-class TileJitterErrorSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileJitterError
-        fields = '__all__'
-
-
-class TileNoiseErrorSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileNoiseError
-        fields = '__all__'
-
-
-class TileModemErrorSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileModemError
-        fields = '__all__'
-
-
-class TileOscillatingErrorSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileOscillatingError
-        fields = '__all__'
-
-
-class TileSpuriousErrorSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileSpuriousError
-        fields = '__all__'
-
-
-class TileRFFailureSerializer(TileErrorSerializer):
-    class Meta:
-        model = TileRFFailure
-        fields = '__all__'
-
-
-class TileErrorPolymorphicSerializer(PolymorphicSerializer):
-    model_serializer_mapping = {
-        TileError: TileErrorSerializer,
-        TileModemError: TileModemErrorSerializer,
-        TileOscillatingError: TileOscillatingErrorSerializer,
-        TileSpuriousError: TileSpuriousErrorSerializer,
-        TileNoiseError: TileNoiseErrorSerializer,
-        TileJitterError: TileJitterErrorSerializer,
-        TileRFFailure: TileRFFailureSerializer
-    }
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/station_test_raw_parser.py b/LCU/Maintenance/DBInterface/monitoringdb/station_test_raw_parser.py
index b2612dc0d367003789d79dd4328d61781d18cc4c..21c83a0042939966882b34ae21330d1124d130fa 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/station_test_raw_parser.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/station_test_raw_parser.py
@@ -5,6 +5,7 @@ from datetime import datetime
 import re
 import logging
 import pytz
+from collections import defaultdict
 
 logger = logging.getLogger('station_test.parser')
 
@@ -18,7 +19,7 @@ def parse_key_value_pairs(content):
     """
     assert '=' in content
     pairs = content.split('=')
-    return {pairs[0]: pairs[1]}
+    return {pairs[0].lower(): pairs[1]}
 
 
 def parse_datetime(date, date_time):
@@ -55,10 +56,10 @@ def parse_raw_station_test(content):
     for stest in station_tests:
         dict_stest = dict_from_raw_station_test(stest)
         logger.debug('parsed test %s', dict_stest)
-        if dict_stest['station_name'] == 'Unknown':
+        if dict_stest['station']['name'] == 'Unknown':
             logger.error('error in the station name for test %s', dict_stest)
             continue
-        if 'start_time' in dict_stest:
+        if 'start_datetime' in dict_stest:
             results.append(dict_stest)
         else:
             return None
@@ -79,268 +80,55 @@ def split_history_into_tests(content):
     return all_tests
 
 
-def dict_from_spu_component_error(content):
-    error_type = content[3]
-    extra_args = content[4:]
-    result = dict()
-    resourcetype = 'SPUComponentError'
-    if error_type == 'VOLTAGE':
-        resourcetype = 'SPUVoltageError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            result['voltage_' + key[0:3].lower()] = float(value)
-    result.update(resourcetype=resourcetype)
-    return result
-
-
-def dict_from_rsp_component_error(content):
-    error_type = content[3]
-    extra_args = content[4:]
-    result = dict()
-    resourcetype = 'RSPComponentError'
-    if error_type == 'VERSION':
-        resourcetype = 'RSPVersionError'
-        for arg in extra_args:
-            result.update(arg)
-
-    elif error_type == 'VOLTAGE':
-        resourcetype = 'RSPVoltageError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'voltage_' + key.replace('.', '_').strip('V')
-            result[key] = float(value)
-
-    elif error_type == 'TEMPERATURE':
-        resourcetype = 'RSPTemperatureError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = key.lower()
-            result[key] = float(value)
-    result.update(resourcetype=resourcetype)
-    return result
-
-
-def dict_from_tbb_component_error(content):
-    error_type = content[3]
-    extra_args = content[4:]
-    result = dict()
-    resourcetype = 'TBBComponentError'
-    if error_type == 'VERSION':
-        resourcetype = 'TBBVersionError'
-        for arg in extra_args:
-            result.update(arg)
-
-    elif error_type == 'VOLTAGE':
-        resourcetype = 'TBBVoltageError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'voltage_' + key.replace('.', '_').strip('V')
-            result[key] = float(value)
-
-    elif error_type == 'TEMPERATURE':
-        resourcetype = 'TBBTemperatureError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = key.lower()
-            result[key] = float(value)
-    result.update(resourcetype=resourcetype)
-    return result
+def parse_component_id(component_id_str):
+    """
+    It parses the component_id string and returns a integer with the component
+    if the string is != --- or None otherwise
+    :param component_id_str: string representation of the component id as in the stationtest output
+    :return: the component id integer
+    """
+    return int(component_id_str) if component_id_str != '---' else None
 
 
-def dict_from_hba_component_error(content):
-    error_type = content[3]
-    extra_args = content[4:]
-    result = dict(tile_errors=[])
-    translate = dict(x='signalX', y='signalY', xoff='signalX_offset', yoff='signalY_offset',
-                     xmean='mean_signalX', ymean='mean_signalY',
-                     proc='percentage', val='value', diff='fluctuation', ref='limit')
-    if error_type in ['C_SUMMATOR', 'P_SUMMATOR']:
-        resourcetype = 'HBASummatorError'
-        type = error_type[0].capitalize()
-        result.update(type=type)
-    elif error_type == 'MODEM':
-        resourcetype = 'HBAModemError'
-
-    elif error_type == 'RF_FAIL':
-        resourcetype = 'HBARFFailError'
-        for arg in extra_args:
-            key, values = arg.popitem()
-            polarization = key.strip().capitalize()
-            measured_signal_nodelay, \
-            measured_signal_fulldelay, \
-            subband_used_nodelay, \
-            subband_used_fulldelay, \
-            reference_signal_nodelay, \
-            reference_signal_fulldelay = map(float, values.replace('nan', '999').split(' '))
-
-            result['measured_signal_nodelay' + polarization] = measured_signal_nodelay
-            result['measured_signal_fulldelay' + polarization] = measured_signal_fulldelay
-            result['subband_used_nodelay' + polarization] = measured_signal_nodelay
-            result['subband_used_fulldelay' + polarization] = subband_used_fulldelay
-            result['reference_signal_nodelay' + polarization] = measured_signal_nodelay
-            result['reference_signal_fulldelay' + polarization] = reference_signal_fulldelay
-    elif error_type == 'SUMMATOR_NOISE':
-        resourcetype = 'HBASummatorNoise'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'polarization' + key.strip().capitalize()
-            result[key] = True
-    elif 'NOISE' in error_type:
-        resourcetype = 'HBANoiseError'
-        type = 'H' if 'HIGH' in error_type else 'L'
-        result.update(type=type)
-        for arg in extra_args:
-            key, value = arg.popitem()
-            polarization = 'X' if 'X' in key else 'Y'
-            key = key.strip('X').strip('Y')
-            if key not in translate:
-                logger.error('cannot translate Noise HBA error in %s ', content)
-                raise Exception('cannot translate Noise HBA error in %s', content)
-            key = translate[key] + polarization
-            if 'value' in key:
-                key = 'peak_' + key
-            result[key] = float(value)
-    elif 'JITTER' in error_type:
-        resourcetype = 'HBAJitterError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            polarization = 'X' if 'X' in key else 'Y'
-            key = key.strip('X').strip('Y')
-            key = 'val' if key == 'ref' else key
-
-            key = translate[key] + polarization
-            if 'value' in key:
-                key = 'average_' + key
-            result[key] = float(value)
-    elif error_type == 'OSCILLATION':
-        resourcetype = 'HBAOscillationError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'polarization' + key.strip().capitalize()
-            result[key] = True
-
-    elif error_type == 'SPURIOUS':
-        resourcetype = 'HBASpuriousError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'polarization' + key.strip().capitalize()
-            result[key] = True
+def collect_error_details(content):
+    """
+    Merge the error_details list of dicts into a unique dict
+    :param content: row describing the component error in a stationtest output
+    :return: a dict with the merged content of the list of dict
+    """
+    error_details = dict()
+    for k in content[4:]:
+        if isinstance(k, dict):
+            error_details.update(k)
+        else:
+            error_details.update({k: True})
 
-    else:
-        raise NotImplementedError('Cannot parse HBA component error %s' % (content,))
-    result.update(resourcetype=resourcetype)
-    return result
+    # Parse RF_FAIL string
+    if 'x' in error_details:
+        rf_fail = parse_rffail_string('x', error_details.pop('x'))
+        error_details.update(rf_fail)
 
+    if 'y' in error_details:
+        rf_fail = parse_rffail_string('y', error_details.pop('y'))
+        error_details.update(rf_fail)
 
-def dict_from_lba_component_error(content):
-    component_type = content[1]
-    error_type = content[3]
-    extra_args = content[4:]
-    result = dict()
-    result['lba_type'] = component_type[-1].lower()
-    translate = dict(x='signalX', y='signalY', xoff='signalX_offset', yoff='signalY_offset',
-                     xmean='mean_signalX', ymean='mean_signalY',
-                     proc='percentage', val='value', diff='fluctuation', ref='limit')
-    resourcetype = 'LBAComponentError'
-    if error_type == 'DOWN':
-        resourcetype = 'LBADownError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = translate[key.lower()]
-            result[key] = float(value)
-
-    elif error_type == 'RF_FAIL':
-        resourcetype = 'LBARFFailError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = translate[key.lower()]
-            result[key] = float(value)
-
-    elif error_type == 'FLAT':
-        resourcetype = 'LBAFlatError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = translate[key.lower()]
-            result[key] = float(value)
-
-    elif error_type == 'SHORT':
-        resourcetype = 'LBAShortError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = translate[key.lower()]
-            result[key] = float(value)
-
-    elif error_type == 'OSCILLATION':
-        resourcetype = 'LBAOscillationError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'polarization' + key.strip().capitalize()
-            result[key] = True
-
-    elif error_type == 'SPURIOUS':
-        resourcetype = 'LBASpuriousError'
-        for arg in extra_args:
-            key, value = arg.popitem()
-            key = 'polarization' + key.strip().capitalize()
-            result[key] = True
-
-    elif 'NOISE' in error_type:
-        type = 'H' if 'HIGH' in error_type else 'L'
-        resourcetype = "LBANoiseError"
-        result.update(type=type)
-        for arg in extra_args:
-            key, value = arg.popitem()
-            polarization = 'X' if 'X' in key else 'Y'
-            key = key.strip('X').strip('Y')
-            key = translate[key] + polarization
-            if 'value' in key:
-                key = 'peak_' + key
-            result[key] = float(value)
-    elif 'JITTER' in error_type:
-        resourcetype = "LBAJitterError"
-        for arg in extra_args:
-            key, value = arg.popitem()
-            polarization = 'X' if 'X' in key else 'Y'
-            key = key.strip('X').strip('Y')
-            key = 'val' if key == 'ref' else key
-
-            key = translate[key] + polarization
-
-            if 'value' in key:
-                key = 'average_' + key
-            result[key] = float(value)
-    result.update(resourcetype=resourcetype)
-    return result
+    return error_details
 
 
 def dict_from_component_error(content):
     """
-    Parse the line that describes the component error and returns a dict
+    Parse the component error into a dict
+    :param content: row representing the component error in the station test output
+    :return:
     """
-    component_id = int(content[2])
-    component_type = content[1]
-    error_type = content[3]
-
-    result = dict(component_id=component_id,
-                  component_type=component_type,
-                  error_type=error_type)
-    if component_type == 'SPU':
-        result.update(dict_from_spu_component_error(content))
-
-    elif component_type == 'RSP':
-        result.update(dict_from_rsp_component_error(content))
-
-    elif component_type == 'RCU':
-        result.update(resourcetype='RCUComponentError')
-    elif component_type == 'TBB':
-        result.update(dict_from_tbb_component_error(content))
-    elif 'LB' in component_type:
-        result.update(dict_from_lba_component_error(content))
-    elif 'HBA' in component_type:
-        result.update(dict_from_hba_component_error(content))
-    else:
-        raise NotImplementedError('Unknown error type ' + str(content))
-    return result
+    component_type, component_id, error_type = content[1:4]
+    error_details = collect_error_details(content)
+
+    component = dict(component_id=parse_component_id(component_id), type=component_type.strip())
+    component_error = dict(component=component,
+                           details=error_details,
+                           type=error_type)
+    return component_error
 
 
 def dict_from_raw_station_test(content):
@@ -359,14 +147,14 @@ def dict_from_raw_station_test(content):
             values = [parse_key_value_pairs(value) if ('=' in value) else value for value in line.split(',')]
 
         preparsed_content.append(values)
-    result = {'components_error': {}}
+    result = {'component_errors': [], 'element_errors': []}
     for row in preparsed_content:
         row_type = row[3]
         if row_type == "STATION":
-            station_name = row[4]['NAME']
+            station_name = row[4]['name']
             station_type = station_name[0].capitalize()
             station_type = station_type if station_type in ['C', 'R'] else 'I'
-            result.update(station_name=station_name, station_type=station_type)
+            result.update(station=dict(name=station_name, type=station_type))
         elif row_type == 'VERSIONS':
             pass
         elif row_type == 'BADLIST':
@@ -374,110 +162,112 @@ def dict_from_raw_station_test(content):
         elif row_type == 'TOOLOW':
             pass
         elif row_type == "RUNTIME":
-            start_time = parse_datetime(row[0], row[4]['START'])
-            end_time = parse_datetime(row[0], row[5]['STOP'])
+            start_time = parse_datetime(row[0], row[4]['start'])
+            end_time = parse_datetime(row[0], row[5]['stop'])
 
-            result.update(start_time=start_time)
-            result.update(end_time=end_time)
+            result.update(start_datetime=start_time)
+            result.update(end_datetime=end_time)
         elif row_type == 'CHECKS':
-            result.update(performed_checks=" ".join(row[4:]))
+            result.update(checks=" ".join(row[4:]))
         elif row_type == 'TESTSIGNAL':
             pass
-        elif row_type == 'NOSIGNAL':
-            pass
         elif row_type == 'STATISTICS':
             pass
         elif row_type == 'DRIVER':
             pass
-        elif row_type == "E_FAIL":
-            tile_errors = dicts_from_tile_error(row[4:])
-            translate_tile_error_to_component_error_type = dict(TileModemError='HBAModemError',
-                                                                TileOscillatingError='HBAOscillationError',
-                                                                TileSpuriousError='HBASpuriousError',
-                                                                TileNoiseError='HBANoiseError',
-                                                                TileJitterError='HBAJitterError',
-                                                                TileRFFailure='HBARFFailError')
-            translate_tile_error_to_component_error = dict(TileModemError='MODEM',
-                                                           TileOscillatingError='OSCILLATIN',
-                                                           TileSpuriousError='SPURIOUS',
-                                                           TileNoiseError='NOISE',
-                                                           TileJitterError='JITTER',
-                                                           TileRFFailure='RF_FAIL')
-
-            for tile_error in tile_errors:
-                linked_type = translate_tile_error_to_component_error_type[tile_error['resourcetype']]
-                component_id = int(row[2])
-
-                if (component_id, linked_type) not in result['components_error']:
-                    error_type = translate_tile_error_to_component_error[tile_error['resourcetype']]
-                    if error_type == 'NOISE':
-                        error_type = 'HIGH_' + error_type if tile_error['type'] == 'H' else 'LOW_' + error_type
-                    new_component_error = dict(resourcetype=linked_type,
-                                               component_id=component_id,
-                                               component_type='HBA',
-                                               error_type=error_type, tile_errors=[])
-                    result['components_error'][(component_id, linked_type)] = new_component_error
-
-                result['components_error'][(component_id, linked_type)]['tile_errors'].append(tile_error)
-
+        elif row_type == 'E_FAIL':
+            result['element_errors'].extend(dicts_from_element_error(row))
         else:
-            if row[2] == '---':
-                logger.error('row type %s unrecognized: %s', row_type, row)
-            else:
-                component_error_dict = dict_from_component_error(row)
-                result['components_error'][(int(row[2]), component_error_dict['resourcetype'])] = component_error_dict
-
-    result['components_error'] = result['components_error'].values()
+            component_error_dict = dict_from_component_error(row)
+            result['component_errors'].append(component_error_dict)
 
     return result
 
 
-def dicts_from_tile_error(contents):
+element_error_name_mapping = {
+    'm':'MODEM',
+    'o':'OSCILLATION',
+    'sp':'SPURIOUS',
+    'hn':'HIGH_NOISE',
+    'ln':'LOW_NOISE',
+    'j':'JITTER',
+    '':'RF_FAIL'
+}
+
+
+def parse_rffail_string(polarization, rf_string):
+    """
+    Parse the string for the rffail test into a dict
+    :param polarization: polarization to which the test (either ['x'|'y'])
+    :param rf_string: content
+    :return: a dict that represent the rf fail test outcome
+    """
+    parameters = list(map(float,rf_string.replace('nan', '999').
+                                replace('-1', '999').
+                                split(' ')))
+    HBA_RF_FAIL_NPARAMETERS = 6
+
+    LBA_RF_FAIL_NPARAMETERS = 1
+
+    if HBA_RF_FAIL_NPARAMETERS == len(parameters):
+        measured_signal_nodelay, measured_signal_fulldelay, subband_used_nodelay, subband_used_fulldelay, \
+        reference_signal_nodelay, reference_signal_fulldelay = map(float,
+                                                                   rf_string.replace('nan', '999').
+                                                                   replace('-1', '999').
+                                                                   split(' '))
+        return {
+            polarization + 'val_full_delay': measured_signal_fulldelay,
+            polarization + 'val_no_delay': measured_signal_nodelay,
+            polarization + 'sb_full_delay': subband_used_fulldelay,
+            polarization + 'sb_no_delay': subband_used_nodelay,
+            polarization + 'ref_full_delay': reference_signal_fulldelay,
+            polarization + 'ref_no_delay': reference_signal_nodelay}
+    elif LBA_RF_FAIL_NPARAMETERS:
+        return {polarization + 'val': parameters[0]}
+    else:
+        raise ValueError('String %s is not a RF_FAIL', rf_string)
+
+
+def dicts_from_element_error(contents):
     """
     Parses the content into a dict that represents the tile error's data
     :param contents:
     :return:
     """
-    results = list()
-    key_pattern = "([^XY0-9]{0,3})([X,Y]{0,1})([0-9]{1,3})"
-    for tile_error in contents:
+    results = defaultdict(dict)
+    key_pattern = "([^xy0-9]{0,3})([x,y]{0,1})([0-9]{1,3})"
+    component_type, component_id, error_type = contents[1:4]
+
+    for tile_error in contents[4:]:
         key, args = tile_error.popitem()
 
-        error_type, polarization, tile_id = re.search(key_pattern, key).groups()
-
-        resourcetype = "TileError"
-        item = dict(tile_id=tile_id, polarization=polarization)
-        if error_type == 'M':
-            item.pop('polarization')
-            resourcetype = 'TileModemError'
-        elif error_type == 'O':
-            resourcetype = 'TileOscillatingError'
-        elif error_type == 'SP':
-            resourcetype = 'TileSpuriousError'
-        elif error_type in ['HN', 'LN']:
-            resourcetype = 'TileNoiseError'
-
-            item['type'] = error_type[0]
+        element_error_type, polarization, element_id = re.search(key_pattern, key).groups()
+        component_error_type = element_error_name_mapping[element_error_type]
+        component = dict(type=component_type,
+                         component_id=int(component_id))
+        component_error = dict(component=component,
+                               type=component_error_type)
+        element = dict(element_id=element_id)
+        element_error = dict(component_error=component_error,
+                             element=element,
+                             type=component_error_type)
+
+        element_error_details = dict()
+        if element_error_type in ['HN', 'LN']:
+
             value, diff = map(float, args.strip().split(' '))
-            item['value'] = value
-            item['diff'] = diff
+            element_error_details[polarization+'val'] = value
+            element_error_details[polarization+'diff'] = diff
 
         elif 'J' in error_type:
-            resourcetype = 'TileJitterError'
-            item['fluctuation'] = float(args.strip())
+            element_error_details[polarization+'diff'] = float(args.strip())
         elif error_type == '':
-            resourcetype = 'TileRFFailure'
-            measured_signal_nodelay, measured_signal_fulldelay, subband_used_nodelay, subband_used_fulldelay, \
-            reference_signal_nodelay, reference_signal_fulldelay = map(float,
-                                                                       args.replace('nan', '999').
-                                                                       replace('-1', '999').
-                                                                       split(' '))
-            item.update(measured_signal_fulldelay=measured_signal_fulldelay,
-                        measured_signal_nodelay=measured_signal_nodelay,
-                        subband_used_fulldelay=subband_used_fulldelay,
-                        subband_used_nodelay=subband_used_nodelay,
-                        reference_signal_fulldelay=reference_signal_fulldelay,
-                        reference_signal_nodelay=reference_signal_nodelay)
-        item.update(resourcetype=resourcetype)
-        results.append(item)
-    return results
+            element_error_details.update(parse_rffail_string(polarization, args))
+
+        element_error['details'] = element_error_details
+        element_error_key = (component_id, element_id, error_type)
+        if element_error_key in results:
+            results[element_error_key]['details'].update(element_error_details)
+        else:
+            results[element_error_key] = element_error
+    return results.values()
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/tests/t_stationtest_model_creation.py b/LCU/Maintenance/DBInterface/monitoringdb/tests/t_stationtest_model_creation.py
index 36cdda36e62e72733083b9c1a4bdb9efe1b394fc..e198e8af58306f4f3efc9f0e22a71b7b44378c21 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/tests/t_stationtest_model_creation.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/tests/t_stationtest_model_creation.py
@@ -1,16 +1,14 @@
 import unittest
 from .common import *
 
-import django.test.testcases
-from .. serializers.stationtest import StationTestSerializer
-from django.test import TestCase
-def TestStationTestModelCreation(TestCase):
+class TestStationTestModelCreation(unittest.TestCase):
 
     def test_all_model_insertion(self):
-        station_test_data = read_station_test_data()
+        station_test_data = read_station_test_data('./test_generic_stationtestdata.csv')
 
         for test in raw_parser.split_history_into_tests(station_test_data):
             result = raw_parser.dict_from_raw_station_test(test)
-            StationTestSerializer().create(result)
+            print(result)
+
 if __name__ == '__main__':
     unittest.main()
\ No newline at end of file
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/urls.py b/LCU/Maintenance/DBInterface/monitoringdb/urls.py
index aa0ab3593527382008f02f7898a2f8ceda3db38c..a736192c12439045ac0c22fb3cd0220005d63c60 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/urls.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/urls.py
@@ -7,10 +7,14 @@ from .views.rtsm_views import *
 station_test_router = routers.DefaultRouter()
 #Station test
 
-station_test_router.register(r'/componenterrors', ComponentErrorViewSet)
-station_test_router.register(r'/tileerrors', TileErrorViewSet)
-station_test_router.register(r'/errors_summary', ComponentErrorCountSummaryViewSet)
-station_test_router.register(r'^', StationTestViewSet)
+station_test_router.register(r'error_details', ErrorDetailsViewSet)
+station_test_router.register(r'element_error', ElementErrorViewSet)
+station_test_router.register(r'element', ElementViewSet)
+station_test_router.register(r'component_error', ComponentErrorViewSet)
+station_test_router.register(r'component', ComponentViewSet)
+
+station_test_router.register(r'station', StationViewSet)
+station_test_router.register(r'station_test', StationTestViewSet)
 
 rtsm_router = routers.DefaultRouter()
 #RTSM
@@ -22,7 +26,7 @@ rtsm_router.register(r'^', RTSMObservationViewSet)
 
 
 urlpatterns = [
-    url(r'stationtests', include(station_test_router.urls)),
+    url(r'stationtests/', include(station_test_router.urls)),
     url(r'rtsm', include(rtsm_router.urls)),
 
     url(r'^api-auth', include('rest_framework.urls', namespace='rest_framework')),
diff --git a/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py b/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
index 94afcf2b4840cd03f5d87dd70a3e0a7b8a84dc8f..45f04c4dab6a88b76884f61bc2a4fcaf90f33840 100644
--- a/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
+++ b/LCU/Maintenance/DBInterface/monitoringdb/views/station_test_views.py
@@ -1,112 +1,185 @@
+from rest_framework.viewsets import ModelViewSet
+
 from .common import *
-from ..models.stationtest import StationTest
-from ..models.componenterror import ComponentError
-from ..models.tileerror import TileError
-from ..serializers.stationtest import StationTestSerializer
-from ..serializers.componenterrors_generic import ComponentErrorPolymorphicSerializer
-
-from ..serializers.tileerror import TileErrorPolymorphicSerializer
-from rest_framework.serializers import Serializer
+from ..models.component import Component
+from ..models.component_error import ComponentError
+from ..models.element import Element
+from ..models.element_error import ElementError
+from ..models.error_details import ErrorDetails
+from ..models.station import Station
+from ..models.station_test import StationTest
+from ..serializers.component import ComponentSerializer
+from ..serializers.component_error import ComponentErrorSerializer
+from ..serializers.element import ElementSerializer
+from ..serializers.element_error import ElementErrorSerializer
+from ..serializers.error_details import ErrorDetailsSerializer
+from ..serializers.station import StationSerializer
+from ..serializers.station_tests import StationTestSerializer
 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 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):
-        """
-        Optionally restrict the list of station test to a
-            specific station
-            time period
-            station_type
-        :return:
-        """
-        queryset = ComponentError.objects.all()
-        for key, param in self.request.query_params.items():
-            if key in RESERVED_FILTER_NAME:
-                continue
-            queryset = queryset.filter(**{key: param})
-            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):
-    queryset = StationTest.objects.all()
-    serializer_class = StationTestSerializer
+class ComponentViewSet(ModelViewSet):
+    serializer_class = ComponentSerializer
+    queryset = Component.objects.all()
+
 
-    def get_queryset(self):
-        """
-        Optionally restrict the list of station test to a
-            specific station
-            time period
-            station_type
-        :return:
-        """
-        queryset = StationTest.objects.all()
-        for key, param in self.request.query_params.items():
-            if key in RESERVED_FILTER_NAME:
-                continue
-            queryset = queryset.filter(**{key: param})
-        return queryset
-
-
-class ComponentErrorViewSet(viewsets.ModelViewSet):
+class ComponentErrorViewSet(ModelViewSet):
+    serializer_class = ComponentErrorSerializer
     queryset = ComponentError.objects.all()
-    serializer_class = ComponentErrorPolymorphicSerializer
-
-    def get_queryset(self):
-        """
-        Optionally restrict the list of station test to a
-            specific station
-            time period
-            station_type
-        :return:
-        """
-        queryset = ComponentError.objects.all()
-        for key, param in self.request.query_params.items():
-            if key in RESERVED_FILTER_NAME:
-                continue
-            queryset = queryset.filter(**{key: param})
-        return queryset
-
-
-class TileErrorViewSet(viewsets.ModelViewSet):
-    queryset = TileError.objects.all()
-    serializer_class = TileErrorPolymorphicSerializer
-
-    def get_queryset(self):
-        """
-        Optionally restrict the list of station test to a
-            specific station
-            time period
-            station_type
-        :return:
-        """
-        queryset = TileError.objects.all()
-        for key, param in self.request.query_params.items():
-            if key in RESERVED_FILTER_NAME:
-                continue
-            queryset = queryset.filter(**{key: param})
-        return queryset
+
+
+class StationViewSet(ModelViewSet):
+    serializer_class = StationSerializer
+    queryset = Station.objects.all()
+
+
+class StationTestViewSet(ModelViewSet):
+    serializer_class = StationTestSerializer
+    queryset = StationTest.objects.all()
+
+
+class ErrorDetailsViewSet(ModelViewSet):
+    serializer_class = ErrorDetailsSerializer
+    queryset = ErrorDetails.objects.all()
+
+
+class ElementErrorViewSet(ModelViewSet):
+    serializer_class = ElementErrorSerializer
+    queryset = ElementError.objects.all()
+
+
+class ElementViewSet(ModelViewSet):
+    serializer_class = ElementSerializer
+    queryset = Element.objects.all()
+
+
+def insert_component_error(station_test_entry,
+                           station_entry,
+                           component_error):
+
+    component = component_error.pop('component')
+    if 'details' in component_error:
+        component_error_details = component_error.pop('details')
+    else:
+        component_error_details = None
+    component_entry = Component.objects.filter(station=station_entry,
+                                               **component).first()
+    if component_entry is None:
+        print('Component entry is not present, inserting ...')
+        component_entry = Component(station=station_entry,
+                                    **component)
+        component_entry.save()
+
+    component_error_entry = ComponentError.objects.filter(component=component_entry,
+                                                          station_test=station_test_entry,
+                                                          **component_error).first()
+    if component_error_entry is None:
+        print('Component error entry is not present, inserting ...')
+        if component_error_details:
+            component_error_details_entry = ErrorDetails(**component_error_details)
+            component_error_details_entry.save()
+
+            component_error_entry = ComponentError(component=component_entry,
+                                                   details=component_error_details_entry,
+                                                   station_test=station_test_entry,
+                                                   **component_error)
+        else:
+            component_error_entry = ComponentError(component=component_entry,
+                                                   station_test=station_test_entry,
+                                                   **component_error)
+        component_error_entry.save()
+    return component_error_entry
+
+
+def insert_component_errors(station_test_entry,
+                            station_entry,
+                            component_errors):
+    for component_error in component_errors:
+        insert_component_error(station_test_entry, station_entry, component_error)
+
+
+def insert_element(component, element):
+    element_entry = Element.objects.filter(component=component,
+                                           **element).first()
+    if element_entry is None:
+        element_entry = Element(component=component,
+                                **element)
+        element_entry.save()
+    return element_entry
+
+
+def insert_element_error(station_test_entry,
+                          station_entry,
+                          element_error):
+    component_error = element_error.pop('component_error')
+
+    component_error_entry = insert_component_error(station_test_entry,
+                                                   station_entry,
+                                                   component_error)
+    component = component_error_entry.component
+
+    element = element_error.pop('element')
+    element_error_details = element_error.pop('details')
+
+    element_entry = insert_element(component, element)
+    print(element_entry)
+
+    element_error_entry = ElementError.objects.filter(element=element_entry,
+                                                      component_error=component_error_entry,
+                                                      station_test=station_test_entry,
+                                                      **element_error)
+    if element_error_entry is None:
+        element_error_details_entry = ErrorDetails(**element_error_details)
+
+        element_error_details_entry.save()
+
+        element_error_entry = ElementError(element=element_entry,
+                                           details=element_error_details_entry,
+                                           component_error=component_error_entry,
+                                           station_test=station_test_entry,
+                                           **element_error)
+
+        element_error_entry.save()
+
+    return element_error_entry
+
+
+def insert_element_errors(station_test_entry,
+                          station_entry,
+                          element_errors):
+    for element in element_errors:
+        insert_element_error(station_test_entry,
+                             station_entry,
+                             element)
+
+
+def insert_station_test(station_test):
+    station = station_test.pop('station')
+    component_errors = station_test.pop('component_errors')
+    element_errors = station_test.pop('element_errors')
+
+    station_entry = Station.objects.filter(**station).first()
+
+    if station_entry is None:
+        print('Station is not present, inserting ...')
+        station_entry = Station(**station)
+        station_entry.save()
+
+    station_test_entry = StationTest.objects.filter(**station_test).first()
+    if station_test_entry is None:
+        print('Station test is not present, inserting ...')
+        station_test_entry = StationTest(station=station_entry,
+                                         **station_test)
+        station_test_entry.save()
+    insert_component_errors(station_test_entry,
+                            station_entry,
+                            component_errors)
+    insert_element_errors(station_test_entry,
+                          station_entry,
+                          element_errors)
+    return (1,1)
 
 
 @api_view(['POST'])
@@ -134,14 +207,10 @@ def insert_raw_station_test(request):
                 station_test_ids = []
                 station_test_ids_already_present = []
                 for entry in parsed_content:
-                    try:
-                        item = StationTestSerializer().create(entry)
-                        station_test_ids.append(item.id)
-                    except ItemAlreadyExists as e:
-                        station_test_ids_already_present.append(e.instance_id)
+                    existing_id, new_id = insert_station_test(entry)
 
             except Exception as e:
-                logger.exception("exception occurred while parsing raw station info %s: %s", request.data['content'], e)
+                logger.exception("exception occurred while parsing raw station info: %s", e)
                 return Response(exception=True,
                                 data="the post message is not correct." +
                                      " It has to be of the form \{'content':[RAWSTRING]\}: %s. Request provided %s" % (