opened 05:55PM - 13 Jun 23 UTC
There are snomed codes that are updated via 'concept replaced by' that are not u…nder the concept_relationship 'maps_to
SQL proof ( as I do not want to import a list of 1,442 id's):
```
SELECT x.concept_id, c.concept_id
FROM saftinet.dbo.concept (NOLOCK) x
INNER JOIN saftinet.dbo.concept_relationship (NOLOCK) cr
ON x.concept_id = cr.concept_id_1 AND cr.relationship_id = 'Concept replaced by'
INNER JOIN saftinet.dbo.concept (NOLOCK) c
ON cr.concept_id_2 = c.concept_id
WHERE x.vocabulary_id = 'SNOMED' AND c.vocabulary_id = 'SNOMED'
AND x.standard_concept <> 'S' AND c.standard_concept = 'S'
EXCEPT
SELECT x.concept_id, c.concept_id
FROM saftinet.dbo.concept (NOLOCK) x
INNER JOIN saftinet.dbo.concept_relationship (NOLOCK) cr
ON x.concept_id = cr.concept_id_1 AND cr.relationship_id = 'maps to'
INNER JOIN saftinet.dbo.concept (NOLOCK) c
ON cr.concept_id_2 = c.concept_id
WHERE x.vocabulary_id = 'SNOMED' AND c.vocabulary_id = 'SNOMED'
AND x.standard_concept <> 'S' AND c.standard_concept = 'S'
```