Skip to content

Instantly share code, notes, and snippets.

@ebot
Created August 8, 2012 13:19
Show Gist options
  • Save ebot/3294975 to your computer and use it in GitHub Desktop.
Save ebot/3294975 to your computer and use it in GitHub Desktop.
require 'nokogiri'
# Read the csv and check each file listed like so
doc = File.read 'file_name.xml'
check_marks = doc.xpath("/ClinicalDocument/StructuredBody/section/title[starts-with(text(), 'CHECK')]/../text/text()").collect(&:text)
add_to_report if check_marks.nil?
<ClinicalDocument>
<Header EditVersion="v0.0" TemplateVersion="24.9" />
<StructuredBody>
<section SectionNum="1" Display="N">
<title>ADT_FACILITYID</title>
<text>HUH</text>
</section>
<section SectionNum="2" Display="N">
<title>REPORT_NAME</title>
<text>Radiation Oncology Treatment Summary</text>
</section>
<section SectionNum="14" Display="N">
<title>CHECK_1</title>
<text />
</section>
<section SectionNum="15" Display="N">
<title>CHECK_2</title>
<text>X</text>
</section>
<section SectionNum="16" Display="N">
<title>CHECK_3</title>
<text />
</section>
</StructuredBody>
<OrigDocument>
<ClinicalDocument>
<Sections>
<SECTION compulsory="0">
<TITLE>ADT_FACILITYID</TITLE>
<BODY>HUH</BODY>
</SECTION>
<SECTION compulsory="0">
<TITLE>REPORT_NAME</TITLE>
<BODY>Radiation Oncology Treatment Summary</BODY>
</SECTION>
<SECTION compulsory="0">
<TITLE>CHECK_1</TITLE>
<BODY>
</BODY>
</SECTION>
<SECTION compulsory="0">
<TITLE>CHECK_2</TITLE>
<BODY>
</BODY>
</SECTION>
<SECTION compulsory="0">
<TITLE>CHECK_3</TITLE>
<BODY>
</BODY>
</SECTION>
</Sections>
</ClinicalDocument>
</OrigDocument>
<MIScan>true</MIScan>
</ClinicalDocument>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment