Its time for another HL7 C-CDA Workshop.  This one is in Dallas, and it should be interesting!

New in this workshop will be the availability of a set of tools for locally running validation on the C-CDA documents that we create.

The validators are not new, we have always had Schematron files available with the standards.  The new aspect is actually getting them to work!

We will have there validators available, C-CDA R1.1, CDA R2.1 and UCUM.

1. The C-CDA R1,1 only provides validation against the specification, so you will still want to use the SITE: Standards Implementation and Testing Environment at  http://sitenv.org. It is my understanding that they will provide "OFFICIAL" MU3 & C-CDA 2.1 validation testing..  So think of these tools may only be useful for training purposes, but they should still be useful.  The UCUM validator was just completed, so it does need to be shaken out a bit.  

The UCUM validator is based on the PEG.js – Parser Generator for JavaScript. Goes to show that you can learn something new, this is the first parser that I've created, so this really needs to be testing and all should consider it alpha code.  To assist others with the evaluation, I'm sharing the PEG syntax used to create the UCUM validator.  

 

/*

 * UCUM Grammar

 * ==========================

 *  Copyright [2015] Calvin E. Beebe

 *

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 * 

 *   http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 *

 *  Note:  The UCUM validator does not include validation for IT unit of measures

 *         It will not validate Kb, Mb, ...

 *

 */

mainterm = "/" term / term

term   = component "." term / component "/" term / component

component = term: ( factor/ annotatable annotation / annotatable / annotation / "(" term ")" ) 

factor = factor:( power10 exponent / digits ) 

power10 =  "10*" / "10^" 

annotatable = unit exponent / unit

annotation = "{" text "}"

text = [^}]* / [ \t] 

unit = nonmetric2 / nonmetric3 / nonmetric4 / nonmetric5 / nonmetric6 / nonmetric7 / nonmetric8 / nonmetric9 / nonmetric10 / nonmetric11 / prefix metric / metric / nonmetric 

prefix = prefix: ("da" / "Y" / "Z" / "E" / "P" / "T" / "G" / "M" / "k" / "h" / "d" / "c" / "m" / "u" / "n" / "p" / "f" / "a" / "z" / "y") 

metric = metric: ("cal_[15]" / "cal_[20]" / "B[10.nV]" / "[eps_0]" / "[mu_0]" / "cal_IT" / "cal_th" / "B[SPL]" / "m[H2O]" / "m[Hg]" / "[m_e]" / "[m_p]" / "B[mV]" / "B[uV]" / "B[kW]" / "cal_m" / "[iU]" / "[IU]" / "[ly]" / "B[W]" / "B[V]" / "rad" / "kat" / "osm"/ "mho" / "mol" / "Ohm" / "Cel" / "bar" / "Gal"  / "cal" / "tex"/ "dyn" / "erg" / "Lmb" / "RAD" / "REM" / "g%" / "eq"  / "eV" / "[h]" / "[k]" / "[e]" / "[c]" / "[G]" / "[g]" / "Bi" / "Ky" /"St" / "Np" / "Mx" / "Oe" / "Gb" / "sb" / "ph" / "Ci" / "pc" / "ar" / "Bq" / "cd" / "gf" / "sr" / "Hz" / "Pa" / "st" / "lm" / "lx" / "Gy" / "Sv" / "Wb" / "B" / "R" / "P" / "G" / "m" / "s" / "g" /  "K" / "C" / "N" / "J" / "W" / "A" / "V" / "F" / "S" / "T" / "H" / "l" / "L" / "t" / "u"  / "U" ) 

nonmetric =  non1: ("[lbf_av]" / "[ppth]" / "[pptr]" / "[ppm]" / "[ppb]" / "mo_s" / "mo_j" / "mo_g" / "[pi]" / "circ" / "gon" / "deg" / "min" / "att" / "sph" / "a_t" / "a_j" / "a_g" / "wk" /  "mo" / "AU" / "Ao" / "h" / "d" / "b" / "a" / "'" / '"' / "%" ) 

nonmetric2 = non2: ("[in_i]" / "[ft_i]" / "[yd_i]" / "[mi_i]" / "[fth_i]" / "[nmi_i]" / "[kn_i]" / "[sin_i]" / "[sft_i]" / "[syd_i]" / "[cin_i]" / "[cft_i]" / "[cyd_i]" / "[bf_i]" / "[cr_i]" / "[mil_i]" / "[cml_i]" / "[hd_i]" ) 

nonmetric3 = non3: ("[ft_us]" / "[yd_us]" / "[in_us]" / "[rd_us]" / "[ch_us]" / "[lk_us]" / "[rch_us]" / "[rlk_us]" / "[fth_us]" / "[fur_us]" / "[mi_us]" / "[acr_us]" / "[srd_us]" / "[smi_us]" / "[sct]" / "[twp]" / "[mil_us]" ) 

nonmetric4 = non4: ("[in_br]" / "[ft_br]" / "[rd_br]" / "[ch_br]" / "[lk_br]" / "[fth_br]" / "[pc_br]" / "[yd_br]" / "[mi_br]" / "[nmi_br]" / "[kn_br]" / "[acr_br]" ) 

nonmetric5 = non5: ("[gal_us]" / "[bbl_us]" / "[qt_us]" / "[pt_us]" / "[gil_us]" / "[foz_us]" / "[fdr_us]" / "[min_us]" / "[crd_us]" / "[bu_us]" / "[gal_wi]" / "[pk_us]" / "[dqt_us]" / "[dpt_us]" / "[tbs_us]" / "[tsp_us]" / "[cup_us]" / "[foz_m]" / "[cup_m]" / "[tsp_m]" / "[tbs_m]" ) 

nonmetric6 = non6: ("[gal_br]" / "[pk_br]" / "[bu_br]" / "[qt_br]" / "[pt_br]" / "[gil_br]" / "[foz_br]" / "[fdr_br]" / "[min_br]" ) 

nonmetric7 = non7: ("[pwt_tr]" / "[oz_tr]" / "[lb_tr]" / "[gr]" / "[lb_av]" / "[oz_av]" / "[dr_av]" / "[scwt_av]" / "[lcwt_av]" / "[ston_av]" / "[lton_av]" / "[stone_av]" ) 

nonmetric8 = non8: ("[lne]" / "[pnt]" / "[pca]" / "[pnt_pr]" / "[pca_pr]" / "[pied]" / "[pouce]" / "[ligne]" / "[didot]" / "[cicero]" / "[psi]" / "[car_m]" / "[car_Au]" / "[smoot]" ) 

nonmetric9 = non9: ("[degF]" / "[degR]" / "[Cal]" / "[Btu_39]" / "[Btu_59]" / "[Btu_60]" / "[Btu_m]" / "[Btu_IT]" / "[Btu_th]" / "[Btu]" / "[HP]" / "[den]" ) 

nonmetric10 = non10: ("[in_i'H2O]" / "[in_i'Hg]" / "[PRU]" / "[wood'U]" / "[diop]" / "[p'diop]" / "%[slope]" / "[mesh_i]" / "[Ch]" / "[drp]" / "[hnsf'U]" / "[MET]" / "[hp'_X]" / "[hp'_C]" / "[hp'_M]" / "[hp'_Q]" / "[hp_X]" / "[hp_C]" / "[hp_M]" / "[hp_Q]" / "[kp_X]" / "[kp_C]" / "[kp_M]" / "[kp_Q]" ) 

nonmetric11 = non11: ("[pH]" / "[S]" / "[HPF]" / "[LPF]" / "[arb'U]" / "[USP'U]" / "[GPL'U]" / "[MPL'U]" / "[APL'U]" / "[beth'U]" / "[anti'Xa'U]" / "[todd'U]" / "[dye'U]" / "[smgy'U]" / "[bdsk'U]" / "[ka'U]" / "[knk'U]" / "[mclg'U]" / "[tb'U]" / "[CCID_50]" / "[TCID_50]" / "[EID_50]" / "[PFU]" / "[FFU]" / "[CFU]" / "[BAU]" / "[AU]" / "[Amb'a'1'U]" / "[PNU]" / "[Lf]" / "[D'ag'U]" / "[FEU]" / "[ELU]" / "[EU]" ) 

exponent = digits / sign digits

digits = first:[1-9] rest: digit* { return first + rest.join("");} / digit

digit  = [0-9]

sign   = [+,-]

If you find any errors please forward a note to me, I would like to have this available to implementers of C-CDA.  My email address is: This email address is being protected from spambots. You need JavaScript enabled to view it.