Skip to content

Commit 5657376

Browse files
authored
For consistency, use "CDM" instead of "OMOP" (#21)
1 parent 2225ee9 commit 5657376

5 files changed

Lines changed: 103 additions & 103 deletions

File tree

src/Generate/generate-types.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ end
6767
export_structs::Bool,
6868
make_all_fields_optional::Bool)::String where F
6969
m = match(pattern, str)
70-
omopname = m[1]
71-
_omopname = strip(omopname)
72-
_omopname_lowercase = lowercase(_omopname)
73-
_omopname_uppercase = uppercase(_omopname)
74-
@debug("Attempting to create a Julia type for the OMOP CDM table \"$(omopname)\"")
75-
structname = string_casing(_omopname)
70+
cdmname = m[1]
71+
_cdmname = strip(cdmname)
72+
_cdmname_lowercase = lowercase(_cdmname)
73+
_cdmname_uppercase = uppercase(_cdmname)
74+
@debug("Attempting to create a Julia type for the OMOP CDM table \"$(cdmname)\"")
75+
structname = string_casing(_cdmname)
7676
fields = String[]
7777
fieldcontentsraw = m[2]
7878
lines = strip.(split(strip(fieldcontentsraw), "\n"))
@@ -90,19 +90,19 @@ end
9090
String[export_statement],
9191
String[""],
9292
String["\"\"\""],
93-
String["OMOP table name: $(_omopname)"],
93+
String["CDM table name: $(_cdmname_uppercase)"],
9494
String[""],
9595
String["Julia struct name: $(structname)"],
9696
String[""],
9797
String["\$(DocStringExtensions.TYPEDEF)"],
9898
String["\$(DocStringExtensions.TYPEDFIELDS)"],
9999
String["\"\"\""],
100-
String["Base.@kwdef struct $(structname) <: OMOPType"],
100+
String["Base.@kwdef struct $(structname) <: CDMType"],
101101
fields,
102102
String["end"],
103103
)
104104
output = join(output_lines, "\n")
105-
@debug("The OMOP CDM table \"$(omopname)\" will become the Julia struct `$(structname)`")
105+
@debug("The OMOP CDM table \"$(cdmname)\" will become the Julia struct `$(structname)`")
106106
return output
107107
end
108108

@@ -113,33 +113,33 @@ end
113113
m = match(pattern, _line)
114114
field_name = m[1]
115115
_field_name = strip(strip(strip(field_name), Char['\"']))
116-
field_omop_type = m[2]
116+
field_cdm_type = m[2]
117117
field_null_or_notnull = m[3]
118-
field_partialtype = _omop_type_to_julia_partialtype(field_omop_type)
118+
field_partialtype = _cdm_type_to_julia_partialtype(field_cdm_type)
119119
field_fulltype = _generate_full_fieldtype(field_partialtype,
120120
field_null_or_notnull;
121121
make_all_fields_optional = make_all_fields_optional)
122122
result = " $(strip(_field_name))::$(strip(field_fulltype))"
123123
return result
124124
end
125125

126-
@inline function _omop_type_to_julia_partialtype(omop_type)::String
126+
@inline function _cdm_type_to_julia_partialtype(cdm_type)::String
127127
varchar_pattern = r"^varchar\([\d]*?\)$"i
128-
_omop_type = lowercase(strip(omop_type))
129-
if _omop_type == "integer"
128+
_cdm_type = lowercase(strip(cdm_type))
129+
if _cdm_type == "integer"
130130
return "Int"
131-
elseif _omop_type == "date"
131+
elseif _cdm_type == "date"
132132
return "Dates.DateTime"
133-
elseif _omop_type == "datetime2"
133+
elseif _cdm_type == "datetime2"
134134
return "Dates.DateTime"
135-
elseif _omop_type == "float"
135+
elseif _cdm_type == "float"
136136
return "Float64"
137-
elseif _omop_type == "varchar(max)"
137+
elseif _cdm_type == "varchar(max)"
138138
return "String"
139-
elseif occursin(varchar_pattern, _omop_type)
139+
elseif occursin(varchar_pattern, _cdm_type)
140140
return "String"
141141
end
142-
throw(ArgumentError("Invalid value for omop_type: $(omop_type)"))
142+
throw(ArgumentError("Invalid value for cdm_type: $(cdm_type)"))
143143
end
144144

145145
@inline function _generate_full_fieldtype(partial_fieldtype,

src/OMOPCommonDataModel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ module OMOPCommonDataModel
33
import Dates
44
import DocStringExtensions
55

6-
export OMOPType
6+
export CDMType
77

88
"""
99
An OMOP Common Data Model (CDM) type.
1010
"""
11-
abstract type OMOPType end
11+
abstract type CDMType end
1212

1313
const CDM_VERSION = v"5.1.3"
1414
include("version.jl")

0 commit comments

Comments
 (0)