   dataset_n.study_time_collected || ' ' || dataset_n.study_time_collected_unit AS timepoint,
   dataset_n.features
 FROM
-    (
+    (                                                                                                                   
        SELECT
          study_time_collected,
          study_time_collected_unit,
-         participantid AS pid,
+         pid,
          COUNT(population_definition_reported) AS features,
          'fcs_analyzed_result' AS Name,
          'Flow Cytometry' AS Label
-       FROM
-          fcs_analyzed_result
+       FROM ( SELECT DISTINCT
+              study_time_collected,
+              study_time_collected_unit,
+              participantid AS pid,
+              population_definition_reported
+              FROM
+              fcs_analyzed_result
+              GROUP BY
+              study_time_collected, study_time_collected_unit, participantid, population_definition_reported)
        GROUP BY
-         study_time_collected, study_time_collected_unit, participantid
+         study_time_collected, study_time_collected_unit, pid
+
+       UNION
+     
+       SELECT
+         study_time_collected,
+         study_time_collected_unit,
+         pid,
+         COUNT(analyte) AS features,
+         'mbaa' AS Name,
+         'MBAA' AS Label
+       FROM ( SELECT DISTINCT
+              study_time_collected,
+              study_time_collected_unit,
+              participantid AS pid,
+              analyte
+              FROM
+              mbaa
+              GROUP BY
+              study_time_collected, study_time_collected_unit, participantid, analyte)
+       GROUP BY
+         study_time_collected, study_time_collected_unit, pid
 
        UNION
        
        SELECT
          study_time_collected,
          study_time_collected_unit,
-         participantid AS pid,
+         pid,
          COUNT(analyte) AS features,
-         'mbaa' AS Name,
-         'MBAA' AS Label
-       FROM
-          mbaa
+        'elisa' AS Name,
+        'ELISA' AS Label
+       FROM ( SELECT DISTINCT
+              study_time_collected,
+              study_time_collected_unit,
+              participantid AS pid,
+              analyte
+              FROM
+              elisa
+              GROUP BY
+              study_time_collected, study_time_collected_unit, participantid, analyte)
        GROUP BY
-         study_time_collected, study_time_collected_unit, participantid
+         study_time_collected, study_time_collected_unit, pid
 
        UNION
        
        SELECT
          study_time_collected,
          study_time_collected_unit,
-         participantid AS pid,
+         pid,
          COUNT(analyte) AS features,
-         'elisa' AS Name,
-         'ELISA' AS Label
-       FROM
-          elisa
+        'elispot' AS Name,
+        'ELISPOT' AS Label
+       FROM ( SELECT DISTINCT
+              study_time_collected,
+              study_time_collected_unit,
+              participantid AS pid,
+              analyte
+              FROM
+              elispot
+              GROUP BY
+              study_time_collected, study_time_collected_unit, participantid, analyte)
        GROUP BY
-         study_time_collected, study_time_collected_unit, participantid
+         study_time_collected, study_time_collected_unit, pid
 
        UNION
-       
+     
        SELECT
          study_time_collected,
          study_time_collected_unit,
          participantid AS pid,
-         COUNT(analyte) AS features,
-         'elispot' AS Name,
-         'ELISPOT' AS Label
-       FROM
-          elispot
-       GROUP BY
-         study_time_collected, study_time_collected_unit, participantid
-
-       UNION
-       
-       SELECT
-         study_time_collected,
-         study_time_collected_unit,
-         participantid AS pid,
-         COUNT(virus) AS features,
+         1 AS features,
          'hai' AS Name,
          'HAI' AS Label
        FROM

-- List the datasets available (is also properly filtered by the Data Finder)
SELECT
  dataset_n.pid AS participantId,
  dataset_n.Name,

         pcr
       GROUP BY
         study_time_collected, study_time_collected_unit, participantid
     
       UNION
     
       SELECT
         study_time_collected,
         study_time_collected_unit,
