Jeffrey Klann  committed 249cbce

Changed _CODETYPE, _CODETYPE4 to _CODE in the json output – I think this makes more sense but it would require special casing in your parser?
Made all types editable (FAE, LAE, RAE)
Changed names to ModifiedCamelCase
ORIGDX is now a modifier
Ddate could be a fact end date, so I removed it
ENCTYPE is now a modifier
Chart is now a modifier
There should be one base fact with an enrollment start/end date
Origpx is now a modifier
Position is now a modifier

  • Participants
  • Parent commits 335ecdb
  • Branches SCILHS

Comments (0)

Files changed (1)


         writer = csv.writer(out)
+def camelCase(word): 
    return ''.join(x.capitalize() or '_' for x in word.split('_'))
 class CDM(object):
     name = 'PCORI'
                                   parts=[table], name=table)
                 for table in cls.spec['tables']]
-    terminology_fields = ['DX_CODETYPE4', 'PX_CODETYPE',
+    terminology_fields = ['DX_CODE', 'PX_CODE',
-    dimension_fields = ['PATID', 'ENCOUNTERID', 'ADATE']
+    dimension_fields = ['PATID', 'ENCOUNTERID', 'ADATE','DDATE', 'ENR_END','FACILITY_LOCATION']
     fact_fields = ['MEASURE_DATE', 'MEASURE_TIME']
-    code_fields = ['DRG', 'DX', 'PX']
+    code_fields = ['DRG_TYPE', 'DX', 'PX']
     modifier_fields = ['DX_SOURCE',
-                       'ENCTYPE',
+                       'CHART',
                        'POSITION', 'VITAL_SOURCE']
     excluded_fields = (dimension_fields
         return [I2B2MetaData.term(pfx=['',],
                                   parts=[t, n],
                                   code=n + ':', name=n,
-                                  viz='LA',
+                                  viz='LAE',
                 for (n, t, hint) in field_parts
                 if n not in cls.excluded_fields
     def _enum_terms(cls, field_ok, pfx,
-                    leaf='LA', folder='FA',
+                    leaf='LAE', folder='FAE',
                     f_parts=lambda t, n: [t, n],
                     v_parts=lambda v: ([v[k]
                                         for k in ['table', 'field', 'code']]),
     def terminology_stubs(cls):
         return cls._enum_terms(
-            leaf='FA',
+            leaf='FAE',
             field_ok=lambda n: n in cls.terminology_fields,
     def modifiers(cls):
         return cls._enum_terms(
-            folder='DA', leaf='RA',
+            folder='DAE', leaf='RAE',
             field_ok=lambda n: n in cls.modifier_fields,
             applies=lambda t: ['',, t],
             f_parts=lambda t, n: [n],
     def term(cls, pfx, parts, name,
-             code=None, viz='CA', applies_to=[], hint=None):
+             code=None, viz='CAE', applies_to=[], hint=None):
         path = '\\'.join(pfx + parts + [''])
         return [
             len(parts), path,
-            code, name, viz,
+            code, camelCase(name), viz,
             '\\'.join(applies_to + ['%']) if applies_to else '@',
             (hint or '')[:850],
             'N', '2001-01-01',