source: ccr2ccd-xslt/trunk/make/FixMeasuresSection.sh@ 1001

Last change on this file since 1001 was 1001, checked in by George Lilly, 14 years ago

latest

File size: 2.2 KB
Line 
1#!/bin/bash/
2#The following files must be in the same directory as the QRDA files being processed:
3#MeasuresAndReportingParametersWithVariables.xml
4#MEASURES-BY-PATIENT.txt
5#This script
6
7
8for MyFile in $(ls -1 /home/nancy/CCR-Template/QRDA/PAT_*_QRDA_V1_0_0-11-04-2010_21.xml);
9do
10 StructuredBodyLine=$(grep -n "<structuredBody" "$MyFile" | awk -F: '{ print $1 }')
11 echo "structuredBody Line number is $StructuredBodyLine"
12 a="$(($StructuredBodyLine+2))"
13 b="$(($StructuredBodyLine+5))"
14 #In or for Saxon to do its work, the file it works on must be valid, so 3 sets of component/section tags were added to allow for those that will be replaced when the Measures and reporting parameters section is replaced in the file. They need to be deleted. The <MeasuresSection/> tag is added in the Header/Parameter document to anchor the replacement. IT will be deleted when the section is put into the file
15 echo "a is $a start line to delete for <components>/<section> pairs"
16 echo "b is $b end line to delete"
17 echo "$MyFile"
18 #We can either put this next line in after the fact or before. Currently it is before
19 #sed -in '/structuredBody/{ s/$/\n<MeasuresSection\/>/ }' "$MyFile"
20 #sed -in "$c"s/<MeasuresSection\/>//p "$MyFile"
21 #MS=$(cat MeasuresAndReportingParametersWithVariables.xml)
22 sed -in "$a","$b"d "$MyFile"
23 #insert the contents of this file after the structured body line
24 sed -in '/MeasuresSection/r MeasuresAndReportingParametersWithVariables.xml' "$MyFile"
25 sed -in s/\<MeasuresSection\\/\>// "$MyFile"
26done
27
28
29rm -rf /home/nancy/CCR-Template/QRDA/PAT*.xmln
30
31NewFunction()
32{
33File="PAT_$1_QRDA_V1_0_0-11-04-2010_21.xml"
34shift
35while [ "0" != "$#" ]
36do
37echo "Now I am in the function"
38echo "$File"
39echo "$1"
40sed -in "s/<!--@@@$1-Tpl@@@//" "$File"
41sed -in "s/<!--@@@$1-Item@@@//" "$File"
42sed -in "s/<!--@@@$1-Act@@@//" "$File"
43sed -in "s/<!--@@@M-Set2011@@@//" "$File"
44sed -in "s/@@@@$1-Tpl@@@@-->//" "$File"
45sed -in "s/@@@@$1-Item@@@@-->//" "$File"
46sed -in "s/@@@@$1-Act@@@@-->//" "$File"
47sed -in "s/@@@@M-Set2011@@@@-->//" "$File"
48sed -in "s/<!--@@@M-Param2011@@@//" "$File"
49sed -in "s/@@@@M-Param2011@@@@//" "$File"
50
51shift
52done
53}
54
55while read Line ;
56do
57echo "$Line"
58
59NewFunction $Line
60done < "MEASURES-BY-PATIENT.txt"
61
62rm -rf /home/nancy/CCR-Template/QRDA/PAT*.xmln
Note: See TracBrowser for help on using the repository browser.