 		  AND NOT (c1.vocabulary_id='RxNorm' AND r.relationship_id='Maps to'); 
 COMMIT;
 
---9 Add upgrade relationships
+--10 Add upgrade relationships
 INSERT /*+ APPEND */ INTO  concept_relationship_stage (
                                         concept_code_1,
                                         concept_code_2,

       AND c.vocabulary_id = 'HCPCS'
       AND c.concept_class_id IN ('HCPCS', 'HCPCS Modifier');

--21 Append resulting file from Medical Coder (in concept_relationship_stage format) to concept_relationship_stage

--22 Add mapping from deprecated to fresh concepts
MERGE INTO concept_relationship_stage crs
     USING (WITH upgraded_concepts
                    AS (SELECT DISTINCT concept_code_1,

                   WHERE vocabulary_id IN (r.vocabulary_id_1, r.vocabulary_id_2));
COMMIT;

--17 Deprecate concepts if we have no active replacement record in the concept_relationship_stage (yes, again)
UPDATE concept_stage cs
   SET cs.valid_end_date =
          (SELECT v.latest_update - 1
