[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] | 7 | for MyFile in $(ls -1 PAT_*_QRDA_V1_0_0-11-10-2010_16.xml);
|
---|
[1001] | 8 | do
|
---|
| 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"
|
---|
| 25 | done
|
---|
| 26 |
|
---|
| 27 |
|
---|
[1004] | 28 | rm -rf PAT*.xmln
|
---|
[1001] | 29 |
|
---|
| 30 | NewFunction()
|
---|
| 31 | {
|
---|
[1004] | 32 | File="PAT_$1_QRDA_V1_0_0-11-10-2010_16.xml"
|
---|
[1001] | 33 | shift
|
---|
| 34 | while [ "0" != "$#" ]
|
---|
| 35 | do
|
---|
| 36 | echo "Now I am in the function"
|
---|
| 37 | echo "$File"
|
---|
| 38 | echo "$1"
|
---|
| 39 | sed -in "s/<!--@@@$1-Tpl@@@//" "$File"
|
---|
[1004] | 40 | sed -in "s/<!--@@@$1-item@@@//" "$File"
|
---|
[1001] | 41 | sed -in "s/<!--@@@$1-Act@@@//" "$File"
|
---|
| 42 | sed -in "s/<!--@@@M-Set2011@@@//" "$File"
|
---|
| 43 | sed -in "s/@@@@$1-Tpl@@@@-->//" "$File"
|
---|
[1004] | 44 | sed -in "s/@@@@$1-item@@@@-->//" "$File"
|
---|
[1001] | 45 | sed -in "s/@@@@$1-Act@@@@-->//" "$File"
|
---|
| 46 | sed -in "s/@@@@M-Set2011@@@@-->//" "$File"
|
---|
| 47 | sed -in "s/<!--@@@M-Param2011@@@//" "$File"
|
---|
[1004] | 48 | sed -in "s/@@@@M-Param2011@@@@-->//" "$File"
|
---|
[1001] | 49 |
|
---|
| 50 | shift
|
---|
| 51 | done
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | while read Line ;
|
---|
| 55 | do
|
---|
| 56 | echo "$Line"
|
---|
| 57 |
|
---|
| 58 | NewFunction $Line
|
---|
| 59 | done < "MEASURES-BY-PATIENT.txt"
|
---|
| 60 |
|
---|
[1004] | 61 | rm -rf PAT*.xmln
|
---|