                                 'attribute', 45,
                                 'administrative concept', 46,
                                 'record artifact', 47,
+                                'navigational concept', 48,
+                                'inactive concept', 49,
+                                'linkage concept', 50,
+                                'link assertion', 51,
+                                'environment / location', 52,
                                 99),
                         rnb)
                      AS rnc

                            AND a.descendant_concept_code = d.concept_code);
   END LOOP;
END;	
COMMIT;		

-- Method 2: For those that slipped through the cracks assign domains by using the class_concept_id
-- Check out which these are and potentially fix and re-run Method 1
UPDATE domain_snomed d
   SET d.domain_id =
          (SELECT CASE c.concept_class_id
                     WHEN 'Clinical Finding' THEN 'Condition'
                     WHEN 'Procedure' THEN 'Procedure'
                     WHEN 'Pharma/Biol Product' THEN 'Drug'
                     WHEN 'Physical Object' THEN 'Device'
                     WHEN 'Model comp' THEN 'Metadata'
                     ELSE 'Observation'
                  END
             FROM concept_stage c
            WHERE     c.concept_code = d.concept_code
                  AND C.VOCABULARY_ID = 'SNOMED')
 WHERE d.domain_id = 'Not assigned';
 COMMIT;
 
 -- 11.7. Update concept_stage from newly created domains.
CREATE INDEX idx_domain_cc
   ON domain_snomed (concept_code);
   

    WHERE rn = 1 AND active = 1;
COMMIT;	
	
--3 Create temporary table with extracted class information and terms ordered by some good precedence
CREATE TABLE tmp_concept_class
AS
