File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222sleep 2
2323
2424# loop through each .csv file in the section folder
25- for fn in ` ls $REPORT_PATH ` ; do
26- echo ` date` : $fn
27- fn_stem=` echo $fn | cut -d. -f 1`
25+ for fn_path in " $REPORT_PATH " /* .csv; do
26+ [ -f " $fn_path " ] || continue
27+ fn=$( basename " $fn_path " )
28+ echo " $( date) : $fn "
29+ fn_stem=${fn% .csv}
2830 # run chexpert - must be run from chexpert folder
29- python $CHEXPERT_PATH /label.py --verbose --reports_path $REPORT_PATH /$fn --output_path ${fn_stem} _labeled.csv --mention_phrases_dir $CHEXPERT_PATH /phrases/mention --unmention_phrases_dir $CHEXPERT_PATH /phrases/unmention --pre_negation_uncertainty_path $CHEXPERT_PATH /patterns/pre_negation_uncertainty.txt --negation_path $CHEXPERT_PATH /patterns/negation.txt --post_negation_uncertainty_path $CHEXPERT_PATH /patterns/post_negation_uncertainty.txt
30- echo ` date` : done!
31+ python " $CHEXPERT_PATH /label.py" --verbose \
32+ --reports_path " $fn_path " \
33+ --output_path " ${fn_stem} _labeled.csv" \
34+ --mention_phrases_dir " $CHEXPERT_PATH /phrases/mention" \
35+ --unmention_phrases_dir " $CHEXPERT_PATH /phrases/unmention" \
36+ --pre_negation_uncertainty_path " $CHEXPERT_PATH /patterns/pre_negation_uncertainty.txt" \
37+ --negation_path " $CHEXPERT_PATH /patterns/negation.txt" \
38+ --post_negation_uncertainty_path " $CHEXPERT_PATH /patterns/post_negation_uncertainty.txt"
39+ echo " $( date) : done!"
3140 echo ' '
32- done
41+ done
Original file line number Diff line number Diff line change 4646 # all intermediate files will be saved in this folder
4747 export OUTPUT_DIR=${INPUT_FILE::- 4}
4848
49- echo $OUTPUT_DIR - running NegBio..
49+ echo " $OUTPUT_DIR - running NegBio.."
5050 python " $NEGBIO_PATH /negbio/negbio_csv2bioc.py" --output " $OUTPUT_DIR /report" " $INPUT_FILE "
5151 python $NEGBIO_PATH /negbio/negbio_pipeline.py section_split --pattern $NEGBIO_PATH /patterns/section_titles_cxr8.txt --output $OUTPUT_DIR /sections $OUTPUT_DIR /report/* --workers=6
5252 python $NEGBIO_PATH /negbio/negbio_pipeline.py ssplit --output $OUTPUT_DIR /ssplit $OUTPUT_DIR /sections/* --workers=6
5757
5858 # ultimate filename we save the labels to
5959 export OUTPUT_LABELS=$OUTPUT_DIR /${fn::- 4} _labels.csv
60- python $NEGBIO_PATH /negbio/ext/chexpert_collect_labels.py --phrases_file $NEGBIO_PATH /patterns/chexpert_phrases.yml --output $OUTPUT_LABELS $OUTPUT_DIR /neg/*
60+ python " $NEGBIO_PATH /negbio/ext/chexpert_collect_labels.py" --phrases_file " $NEGBIO_PATH /patterns/chexpert_phrases.yml" --output " $OUTPUT_LABELS " " $OUTPUT_DIR " /neg/*
6161 fi
6262done
6363echo " Done looping through files."
You can’t perform that action at this time.
0 commit comments