Skip to content

Commit ad61c53

Browse files
diatomsRcoolclaude
andcommitted
Add three-layer variable schema with microschema integration
- Update schema to import clinical-microschemas and linkml-microschema-profile - Remove local unit and data_type slot definitions in favour of imported versions - Add missing namespace prefixes (OMOP, OBA, LOINC, UCUM, UBERON, MONDO, HP, MMO, RxNorm, ISO11179) - Add FhsHeight002 class declaring conformance to HumanBodyHeightRecord002 microschema - Add inlined_as_list to missing_value slot - Replace placeholder test data with real SingleVariable, FhsHeight002, and CompoundVariable examples - Regenerate Python datamodels Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 03fd057 commit ad61c53

8 files changed

Lines changed: 4318 additions & 160 deletions

File tree

src/bdc_variable_library/datamodel/bdc_variable_library.py

Lines changed: 2411 additions & 99 deletions
Large diffs are not rendered by default.

src/bdc_variable_library/datamodel/bdc_variable_library_pydantic.py

Lines changed: 1791 additions & 18 deletions
Large diffs are not rendered by default.

src/bdc_variable_library/schema/bdc_variable_library.yaml

Lines changed: 71 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ prefixes:
1616
PATO: http://purl.obolibrary.org/obo/PATO_
1717
example: http://www.example.org/rdf#
1818
bdchm: https://w3id.org/bdchm/
19+
OMOP: https://athena.ohdsi.org/search-terms/terms/
20+
OBA: http://purl.obolibrary.org/obo/OBA_
21+
LOINC: https://loinc.org/
22+
UCUM: https://units-of-measurement.org/
23+
UBERON: http://purl.obolibrary.org/obo/UBERON_
24+
MONDO: http://purl.obolibrary.org/obo/MONDO_
25+
HP: http://purl.obolibrary.org/obo/HP_
26+
MMO: http://purl.obolibrary.org/obo/MMO_
27+
RxNorm: http://purl.bioontology.org/ontology/RXNORM/
28+
ISO11179: http://purl.org/iso11179/
1929
default_prefix: bdc_variable_library
2030
default_range: string
2131

2232
imports:
2333
- linkml:types
34+
- https://raw.githubusercontent.com/linkml/linkml-microschema-profile/v0.3.0/src/linkml_microschema_profile/schema/linkml_microschema_profile
35+
- https://raw.githubusercontent.com/linkml/clinical-microschemas/v0.0.1/src/clinical_microschemas/schema/clinical_microschemas
2436

2537
classes:
2638

@@ -85,10 +97,29 @@ classes:
8597
slots:
8698
- indicator_char
8799
- indicator_meaning
100+
101+
MetadataVariable:
102+
is_a: Entity
103+
description: >-
104+
Specific data point used to add information to an observation. This will
105+
typically be a unique identifier for a SingleVariable and a slot from a
106+
microschema
107+
slots:
108+
- variable_path
109+
- microschema_slot
110+
111+
FhsHeight002:
112+
is_a: CompoundVariable
113+
description: >-
114+
FHS height variable harmonized to HumanBodyHeightRecord002 microschema
115+
instantiates:
116+
- HumanBodyHeightRecord002
88117

89118
ResearchStudy:
90119
is_a: Entity
91120
class_uri: bdchm:ResearchStudy
121+
description: >-
122+
Name of research study that produced the variable
92123
93124
slots:
94125
id:
@@ -126,15 +157,6 @@ slots:
126157
description: >-
127158
Description of the variable provided by the original data provider
128159
Corresponds to the VARDESC field in dbGAP
129-
data_type:
130-
range: DataTypeEnum
131-
description: >-
132-
The data type found in this variable. Corresponds to the TYPE field
133-
in dbGAP
134-
unit:
135-
range: string
136-
description: >-
137-
Ideally a unit of measure from UCUM. Corresponds to the UNITS field in dbGAP
138160
minimum_value:
139161
range: decimal
140162
description: >-
@@ -158,6 +180,8 @@ slots:
158180
missing_value:
159181
range: MissingValue
160182
multivalued: true
183+
inlined: true
184+
inlined_as_list: true
161185
description: >-
162186
Sentinel value to indicate a missing value or other data nuance
163187
comment:
@@ -180,8 +204,13 @@ slots:
180204
OMOP, or LOINC
181205
bdchm_type:
182206
range: BdchmTypeEnum
207+
description: >-
208+
Entity type from BDCHM that defines the variable type
183209
metadata:
210+
range: MetadataVariable
184211
multivalued: true
212+
inlined: true
213+
inlined_as_list: true
185214
description: >-
186215
List of variable identifiers providing metadata for a compound variable
187216
alert_value:
@@ -200,32 +229,47 @@ slots:
200229
description: >-
201230
Meaning of the indicator character verbatim from original data provider
202231
when possible
232+
variable_path:
233+
range: string
234+
description: >-
235+
Unique identifier pointing to variable
236+
microschema_slot:
237+
range: ClinicalMicroschemaEnum
238+
description: >-
239+
The slot that the variable identified in the variable path should go
203240
204241
enums:
205-
DataTypeEnum:
206-
description:
207-
A category of data
208-
permissible_values:
209-
NUMERIC:
210-
description: >-
211-
decimal or integer data type for continuous variables
212-
STRING:
213-
description: >-
214-
free text data type
215-
CODE:
216-
description: >-
217-
data are a list of acceptable values or a controlled vocabulary
218242

219243
BdchmTypeEnum:
220-
description:
244+
description: >-
221245
A list of BDCHM entities used to describe variables
222246
permissible_values:
223-
OBSERVATION:
247+
observation:
224248
meaning: bdchm:Observation
225-
CONDITION:
249+
condition:
226250
meaning: bdchm:Condition
227-
PROCEDURE:
251+
procedure:
228252
meaning: bdchm:Procedure
229-
EXPOSURE:
253+
exposure:
230254
meaning: bdchm:Exposure
231255

256+
ClinicalMicroschemaEnum:
257+
description: >-
258+
A list of slots describing clinical measurements in microschema
259+
permissible_values:
260+
subject_identifier:
261+
measurement_type:
262+
measurement_value:
263+
unit:
264+
method:
265+
instrument:
266+
reagent_kit:
267+
calculated_from:
268+
body_location:
269+
body_position:
270+
context:
271+
collected_by:
272+
data_type:
273+
age_at_measurement:
274+
study_site:
275+
absolute_time:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
id: DMCharmonizationPilotHeight
2+
associated_study: DMCPilotv1
3+
variable_description: "Height"
4+
concept_type: OBA:VT0001253
5+
variable_label: "Height"
6+
cde_id: CONDOR:00001
7+
bdchm_type: observation
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
id: FHSg3b0483phv00177539c
2+
associated_study: FraminghamHeartStudy000007
3+
variable_description: "Height"
4+
concept_type: OBA:VT0001253
5+
variable_label: "Height"
6+
cde_id: CONDOR:00001
7+
bdchm_type: observation
8+
metadata:
9+
- id: meta:001
10+
variable_path: pht003094.phv00177539
11+
microschema_slot: measurement_value
12+
- id: meta:002
13+
variable_path: pht003099.phv00177932
14+
microschema_slot: age_at_measurement
15+
- id: meta:003
16+
variable_path: pht003094.phv00177237
17+
microschema_slot: subject_identifier

tests/data/valid/Person-001.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/data/valid/PersonCollection-001.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
id: FHSg3b0483phv00177539s
2+
associated_study: FraminghamHeartStudy000007
3+
variable_description: "Height"
4+
concept_type: OBA:VT0001253
5+
variable_label: "Height"
6+
source_id: phv00177539v6p14
7+
file_id: pht003094v6
8+
file_name: e_exam_2011_m_0017s
9+
variable_name: g3b0483
10+
source_variable_description: "Anthropometry: Height"
11+
data_type: decimal
12+
unit: https://units-of-measurement.org/%5Bin_i%5D
13+
minimum_value: 53.75
14+
maximum_value: 78.5
15+
missing_value:
16+
- id: mv:001
17+
indicator_char: "."
18+
indicator_meaning: "Not done or unknown"
19+
comment: >-
20+
G3B0483-G3B0484 are related variables. See annotated form for relationship between
21+
related variables

0 commit comments

Comments
 (0)