根据,这可能无法从任何地方访问,93880001 有三个父项:
- 肺部恶性肿瘤(疾病)
- 胸内器官原发性恶性肿瘤(病症)
- 原发性呼吸道恶性肿瘤(疾病)
和31个孩子:
- 肺实质癌(疾病)
- 肺上皮样血管内皮瘤(疾病)
- 肺非霍奇金淋巴瘤(疾病)
- 非小细胞肺癌(疾病)
- 等等...
查找层次结构的较高和较低级别的方法是使用relationship_f.sourceid
and relationship_f.destinationid
。然而,原始表格对用户不友好,所以我建议做一些视图。我从 Oracle .sql 文件中获取了代码this https://github.com/bcarlsenca/SNOMED-DB-Load-Scripts/blob/master/src/main/resources/rf2/oracle_views.sqlGitHub 存储库。
首先,我们创建一个包含概念 ID 和首选名称的视图:
create view conceptpreferredname as
SELECT distinct c.id conceptId, d.term preferredName, d.id descriptionId
FROM postgres.snomedct.concept_f c
inner JOIN postgres.snomedct.description_f d
ON c.id = d.conceptId
AND d.active = '1'
AND d.typeId = '900000000000013009'
inner JOIN postgres.snomedct.langrefset_f l
ON d.id = l.referencedComponentId
AND l.active = '1'
AND l.refSetId = '900000000000508004' -- GB English
AND l.acceptabilityId = '900000000000548007';
然后我们来看看关系:
CREATE VIEW relationshipwithnames AS
SELECT id, effectiveTime, active,
moduleId, cpn1.preferredName moduleIdName,
sourceId, cpn2.preferredName sourceIdName,
destinationId, cpn3.preferredName destinationIdName,
relationshipGroup,
typeId, cpn4.preferredName typeIdName,
characteristicTypeId, cpn5.preferredName characteristicTypeIdName,
modifierId, cpn6.preferredName modifierIdName
from postgres.snomedct.relationship_f relationship,
conceptpreferredname cpn1,
conceptpreferredname cpn2,
conceptpreferredname cpn3,
conceptpreferredname cpn4,
conceptpreferredname cpn5,
conceptpreferredname cpn6
WHERE moduleId = cpn1.conceptId
AND sourceId = cpn2.conceptId
AND destinationId = cpn3.conceptId
AND typeId = cpn4.conceptId
AND characteristicTypeId = cpn5.conceptId
AND modifierId = cpn6.conceptId;
因此,打印三个父概念的名称和 ID 的查询将是:
select *
from relationshipwithnames r
where r.sourceId = '93880001'
and r.active = '1'
and r.typeIdName = 'Is a';
请注意,这实际上返回了三个额外的概念,在线 SNOMED 浏览器认为这些概念已经过时。我不知道为什么。
要打印子概念的名称和 ID,请替换destinationId
with sourceId
:
select *
from relationshipwithnames r
where r.destinationId = '93880001'
and r.active = '1'
and r.typeIdName = 'Is a';
请注意,这实际上返回了 16 个额外的概念,在线 SNOMED 浏览器认为这些概念已经过时。同样,我找不到可靠的方法来从结果中仅排除这十六个。
从这里开始,查询祖父母和孙子女就很简单了。