 	c1.vocabulary_id AS vocabulary_id_1,
 	c1.vocabulary_id AS vocabulary_id_2,
 	'Subsumes' AS relationship_id,
-	least (
-			(
-				SELECT latest_update
-				FROM vocabulary
-				WHERE vocabulary_id = c1.vocabulary_id
-			),
-			current_date
+		(
+			SELECT latest_update
+			FROM vocabulary
+			WHERE vocabulary_id = c1.vocabulary_id
 		) AS valid_start_date,
 	TO_DATE('20991231', 'yyyymmdd') AS valid_end_date,
 	NULL AS invalid_reason

	AND i.concept_code IS NULL
	AND a.synonym_concept_code IS NULL
	AND c.concept_code NOT LIKE 'MTHU00000_';-- to exclude internal technical source codes

--9. Build 'Subsumes' relationships from ancestors to immediate descendants using concept code similarity (c2.concept_code LIKE c1.concept_code || '_')
CREATE INDEX IF NOT EXISTS trgm_idx ON concept_stage USING GIN (concept_code devv5.gin_trgm_ops); -- for LIKE patterns
ANALYZE concept_stage;


		);
DROP INDEX trgm_idx;

--11. Deprecate 'Subsumes' relationships for resurrected concepts to avoid possible violations of the hierarchy
INSERT INTO concept_relationship_stage (
	concept_code_1,
	concept_code_2,
