HL7 V2 auto-generation of the structured parts of the standard
The tools here assume that you've already got a copy of the updated V2 xml Schema and hl7v25tables.csv (for the tables)
Once you've got the original V2 XML Schemas and the update V2.xml Schemas and hl7v25tables.csv (for the tables) you can start generating some of the structured content for the Word document using to tools listed below.
We start with the Abstract Message Structure [AMS]. xsd2amshtm.pl will create a HTML table with all the Word syntax, for any message structure, which can then be include in the Word document, replacing the existing table/structure. [hl7v25tables.csv is required for HL7 Table 0076 (the description of the message type) and HL7 Table 0354 (to see if this trigger event is the first known trigger event for this message type, and hence this message definition needs to be tagged for cross reference linking from Appendix A). Everything else comes from the modified segments.xsd] (xsd2amshtm.pl updated 7-November-2007 to change link to Segments, with links like "CHnn.doc#segNNN" and to be linked to, with links like "CHnn.doc#msgNNN" and make the Chapter column link as well as the segment name. updates 6-November-2007 for segments in specific message marked as "retained for backward compatibility")
Next, we move on to the data types. xsd2datatypehtm.pl will create a HTML table with all the Word syntax, for any data type, which can then be included in the Word document, replacing the existing data type table. hl7v25tables.csv is required as it is the only place where you find a definition of which chapter contains which table. (xsd2datatypehtm.pl updated 4-November-2007 to insert anchors so data types can be linked to, with links like "CH02A.doc#NNN)
Then the segments. xsd2segmenthtm.pl will create a HTML table with all the Word syntax, for any segment, which can then be included in the Word document, replacing the existing segment table. hl7v25tables.csv is required as it is the only place where you find a definition of which chapter contains which table. (xsd2segmenthtm.pl updated 4-November-2007 to insert links to data types, with links like "CH02A.doc#NNN" and to link to Tables with links like "CHnn.doc#HL7nnnn" and to insert tags so Segments can be linked to with links like "CHnn.doc#segNNN")
Then the tables. mktablehtm.pl will create a HTML table with all the Word syntax, for any HL7 or User-defined table, which can then be included in the Word document, replacing the existing tables definition. Obviously hl7v25tables.csv is required. (updated 5-November-2007 to insert anchors so Tables can be linked to, with links like "CHnn.doc#HL7nnnn" and to convert XML reserved characters like <, to XML codes like < )
So now you have everything you need to auto-generate the chapters. All you need is a document on how to insert linked HTML documents into Word documents. The Word document "Inserting Linked HTML documents into a Word document.doc" should help you on your way. (updated 1-November-2007)
And of course, then there's Appendix A. Unfortunately each section of Appendix A has to be generated differently. mkAppA3htm.pl will generate Appendix A.3 (updated 7-November-2007), mkAppA4htm.pl will generate Appendix A.4 (updated 7-November-2007), mkAppA5htm.pl will generate Appendix A.5 (updated 7-November-2007), mkAppA6htm.pl will generate Appendix A.6 (updated 7-November-2007 [FixXML() to convert things like < to things like < ]) and mkAppA7htm.pl will generate Appendix A.7 (updated 4-November-2007). All of the auto-generated Appendicies are fully linked back to the data types, message structures, segments and tables in the chapters.
And finally, a blast from the past - Appendix C, which can be generated by feeding a list of V2.xml Schema to mkAppCxsd2bnf.pl. The Shell script doAppC.sh does just that, by reading v25files.txt and feeding it to mkAppCxsd2bnf.pl (updated 4-November-2007)
Some Useful Scripts.
When I'm auto-generating the structured contents, I place all of the above scripts into a directory, then create a "working" directory below that. And in the "working" directory I have a sub-folder for each chapters (CH02, CH02A etc). So, the following script come from those sub-folders and will auto-generate the structured content for the appropriate chapters. They will, of course, have path references in them appropriate to that structure - e.g. things like
(cd ../..; perl xsd2amshtm.pl -v 25 -m ADT -t A01 ADT_A01.xsd > working/CH03/ADT_A01.htm)
(cd ../..; perl xsd2amshtm.pl -v 25 -m ACK -t A01 ACK.xsd > working/CH03/ACK_A01.htm)
(cd ../..; perl xsd2segmenthtm.pl -v 25 PID > working/CH03/PID.htm)
(cd ../..; perl mkTablehtm.pl -v 25 HL70200 > working/CH03/HL70200.htm)
(cd ../..; perl mkTablehtm.pl -v 25 User0001 > working/CH03/User0001.htm)
doCH02.sh - for auto-generating all the structured content of Chapter 2
doCH02A.sh - for auto-generating the structured content of Chapter 2A
doCH03.sh - for auto-generating the structured content of Chapter 3
doCH07.sh - for auto-generating the structured content of Chapter 7
doCH11.sh - for auto-generating the structured content of Chapter 11
doCH12.sh - for auto-generating the structured content of Chapter 12
doCH15.sh - for auto-generating the structured content of Chapter 15
doAppA.sh - for auto-generating the tables in Appendix A
This Web Site is maintained by Russell McDonell - russell.mcdonell@c-cost.com