Skip to content

Instantly share code, notes, and snippets.

@jumblies
Created March 12, 2018 16:35
Show Gist options
  • Save jumblies/9557116071ed076eacca3bb75a808e41 to your computer and use it in GitHub Desktop.
Save jumblies/9557116071ed076eacca3bb75a808e41 to your computer and use it in GitHub Desktop.
counter snippet
# Set final initial counters to zero
mriFinal, ctHeadFinal, ctAbdFinal, crFinal, usFinal, ctChestFinal = 0, 0, 0, 0, 0, 0
# Set prelim initial counters to zero ****THIS SNIPPET DOES NOT INCLUDE PRELIM PROCESSING
mriPrelim, ctHeadPrelim, ctAbdPrelim, crPrelim, usPrelim, ctChestPrelim = 0, 0, 0, 0, 0, 0
prelim, final=0,0
finalExceptions = []
prelimExceptions = []
for line in processFile:
if "[Final report]" in line:
final +=1
if "MRI" in line:
mriFinal += 1
elif "CT ABDOMEN" in line or "CTA ABDOMEN" in line:
ctAbdFinal += 1
elif "CT CHEST" in line or "CTA CHEST" in line:
ctChestFinal += 1
elif "CT HEAD" in line:
ctHeadFinal += 1
elif "CR " in line:
crFinal += 1
elif "US " in line:
usFinal += 1
else:
finalExceptions.append(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment