         GROUP BY concept_id_1
          )
 
-SELECT DISTINCT source_concept_id,
-                source_concept_name,
-                source_domain_id,
-                source_vocabulary_id,
-                source_concept_class_id,
-                --source_standard_concept,
-                source_concept_code,
-                source_c.valid_start_date,
-                source_c.valid_end_date,
-                --source_c.invalid_reason,
+SELECT DISTINCT c.concept_code AS concept_code, c.concept_name AS concept_name,
+                NULL::varchar AS relationship_id,
                 CASE WHEN previous_mappings.concept_id_1 IS NOT NULL    --Mapping was available
                           AND NOT EXISTS (SELECT concept_id_1 FROM dev_loinc.concept_relationship lcr
                           JOIN dev_loinc.concept lc
                           ON lc.concept_id = lcr.concept_id_1 AND lc.vocabulary_id = 'LOINC'
                           WHERE lcr.relationship_id IN ('Maps to', 'Maps to value') AND lcr.invalid_reason IS NULL
                                 AND lcr.concept_id_1 = c.concept_id --Concept_id never changes
-                              ) THEN 'Was mapped and don''t have replacement'
+                              )
+                          AND previous_mappings.standard_concept = 'S'
+                    THEN 'Was Standard and don''t have replacement now'
+
+                    WHEN previous_mappings.concept_id_1 IS NOT NULL    --Mapping was available
+                          AND NOT EXISTS (SELECT concept_id_1 FROM dev_loinc.concept_relationship lcr
+                          JOIN dev_loinc.concept lc
+                          ON lc.concept_id = lcr.concept_id_1 AND lc.vocabulary_id = 'LOINC'
+                          WHERE lcr.relationship_id IN ('Maps to', 'Maps to value') AND lcr.invalid_reason IS NULL
+                                AND lcr.concept_id_1 = c.concept_id --Concept_id never changes
+                              )
+                          AND previous_mappings.standard_concept != 'S'
+                    THEN 'Was non-Standard but mapped and don''t have replacement now'
 
 --TODO: There are 2 concepts but LOINC hasn't been ran after snomed refresh so the mappings just died.
                 WHEN previous_mappings.concept_id_1 IN


                WHEN c.concept_code NOT IN (SELECT concept_code FROM devv5.concept WHERE vocabulary_id = 'LOINC')
                                THEN 'New and not-mapped'
                                ELSE 'Not mapped' END AS flag
FROM dev_loinc.concept c
LEFT JOIN previous_mappings
ON c.concept_id = previous_mappings.concept_id_1

        AND cr.relationship_id IN ('Maps to', 'Maps to value')
        AND cr.invalid_reason IS NULL

        GROUP BY concept_id_1, standard_concept
        ),

     current_mapping AS
