unresolvable fk cycles between concept and concept_class

未关闭
#706 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
postgresql, python
领域
databases

调研方向

从 ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_ddl.sql 的第 422 行和第 444 行附近开始,然后检查 OMOPCDM_postgresql_5.4_constraints.sql 中第 156 行和第 159 行附近对应的外键定义。确定 schema 是否提供了能够保留这两个约束的受支持插入路径;记录经过验证的操作步骤或所需的 schema 修正,并提供一个可复现的示例,展示可以插入 concept 和 concept_class 数据。

由索引模型根据 Issue 内容生成。

描述

Question

Howdy lovely CDM Community,

i am new to all this and i am in the process to create a bunch of python representations for the OMOP-CDM Model (https://github.com/DZD-eV-Diabetes-Research/dzd-omop-cdm-python-models) .

Now i ran into a problem with the CDM schema leaving me scratching my head:

In 5.4 we have the table concept which has a NOT NULL-able foreign key that references concept_class

FK Col concept_class_id in concept: https://github.com/OHDSI/CommonDataModel/blob/main/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_ddl.sql#L422

FK definition: https://github.com/OHDSI/CommonDataModel/blob/main/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_constraints.sql#L156

At the same time we have a NOT NULL-able foreign key in concept_class that references concept

FK Col concept_class_concept_id in concept_class - https://github.com/OHDSI/CommonDataModel/blob/main/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_ddl.sql#L444

FK definition: https://github.com/OHDSI/CommonDataModel/blob/main/ddl/5.4/postgresql/OMOPCDM_postgresql_5.4_constraints.sql#L159

The problem is if i want to create a new row in concept i need an existing concept_class to reference but if i want to create concept_class i need an existing concept to reference but if i want to create a new concept... you get the point :)

How am i supposed to insert concept data without having some cumbersome scripts that will disable constraints under certain circumstances (which runs against the whole idea of having a data model with constraints in the first place)

I could not find any information on how to solve this in a cleanly manner. if anyone has any hints for me, I would be very grateful. cheers.

主要语言
HTML
星标
1.1k
派生
515
平均合并
10 天 13 小时
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OHDSI/CommonDataModel 的其他 Issue

查看 OHDSI/CommonDataModel 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。