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

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

final PQRI files

File size: 2.2 KB
RevLine 
[1001]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
[1004]5#This script which is FixMeasuresSection.sh
[1001]6
[1004]7for MyFile in $(ls -1 PAT_*_QRDA_V1_0_0-11-10-2010_16.xml);
[1001]8do
9 StructuredBodyLine=$(grep -n "<structuredBody" "$MyFile" | awk -F: '{ print $1 }')
10 echo "structuredBody Line number is $StructuredBodyLine"
11 a="$(($StructuredBodyLine+2))"
12 b="$(($StructuredBodyLine+5))"
13 #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
14 echo "a is $a start line to delete for <components>/<section> pairs"
15 echo "b is $b end line to delete"
16 echo "$MyFile"
17 #We can either put this next line in after the fact or before. Currently it is before
18 #sed -in '/structuredBody/{ s/$/\n<MeasuresSection\/>/ }' "$MyFile"
19 #sed -in "$c"s/<MeasuresSection\/>//p "$MyFile"
20 #MS=$(cat MeasuresAndReportingParametersWithVariables.xml)
21 sed -in "$a","$b"d "$MyFile"
22 #insert the contents of this file after the structured body line
[1004]23 sed -in '/MeasuresSection/r MeasuresAndReportingParametersWithVariables2011.xml' "$MyFile"
[1001]24 sed -in s/\<MeasuresSection\\/\>// "$MyFile"
25done
26
27
[1004]28rm -rf PAT*.xmln
[1001]29
30NewFunction()
31{
[1004]32File="PAT_$1_QRDA_V1_0_0-11-10-2010_16.xml"
[1001]33shift
34while [ "0" != "$#" ]
35do
36echo "Now I am in the function"
37echo "$File"
38echo "$1"
39sed -in "s/<!--@@@$1-Tpl@@@//" "$File"
[1004]40sed -in "s/<!--@@@$1-item@@@//" "$File"
[1001]41sed -in "s/<!--@@@$1-Act@@@//" "$File"
42sed -in "s/<!--@@@M-Set2011@@@//" "$File"
43sed -in "s/@@@@$1-Tpl@@@@-->//" "$File"
[1004]44sed -in "s/@@@@$1-item@@@@-->//" "$File"
[1001]45sed -in "s/@@@@$1-Act@@@@-->//" "$File"
46sed -in "s/@@@@M-Set2011@@@@-->//" "$File"
47sed -in "s/<!--@@@M-Param2011@@@//" "$File"
[1004]48sed -in "s/@@@@M-Param2011@@@@-->//" "$File"
[1001]49
50shift
51done
52}
53
54while read Line ;
55do
56echo "$Line"
57
58NewFunction $Line
59done < "MEASURES-BY-PATIENT.txt"
60
[1004]61rm -rf PAT*.xmln
Note: See TracBrowser for help on using the repository browser.