We created prefetch rules based on body part because our display protocols were based on body part, but our prefetch rules were still generic and pulled based on modality and performed date. Not only does this mean that studies were not always ready to compare for our rads, but relevant studies that get ad-hoc pulled don’t drop off as prefetched studies, wasting valuable cache2 space.
Creating prefetch rules has the potential to be a huge job as some sites get really specific with body parts, so there can be a lot of changes to make. You can also go a few steps further and pull by multiple criteria if your rads are really specific about their needs. However, the steps and scripts below make the basics of this job pretty damn easy, and you could always start here to get 90% relevant pulls and then pick away at that harder stuff.
First, we needed a list of all the body parts we were using, which is easily accessible through the database (accessed through SQLPlus):
select * from body_part;
Returns:
MY_BODY_PART_ID MY_CODE MY_DESCRIPTION
--------------- ---------------------------- --------------------------
1 ABDOMEN Abdomen
2 AORTA Aorta
218 BONE-SURVEY Bone Survey
4 ANKLE-L Ankle, Left
5 ANKLE-R Ankle, Right
This gives us our headers, and I wanted to make sure that there wasn’t too much extra crap in the results. It looks fairly good, so I just want it exported and cleaned up a little:
SQL> spool body.txt;
SQL> set linesize 1000
SQL> set wrap off
SQL> set trimspool on
SQL> set trimout on
SQL> set pagesize 0
SQL> select * from body_part;
Returns:
1 ABDOMEN Abdomen
2 AORTA Aorta
218 BONE-SURVEY Bone Survey
4 ANKLE-L Ankle, Left
5 ANKLE-R Ankle, Right
148 ANKLE-B Ankle, Bilat
227 EXTREMITY-U Extremity, Unknown
237 ABDOMEN-PELVIS Abdomen/Pelvis
9 BLADDER Bladder
10 BRAIN Brain
149 CLAVICLE-B Clavicle, Bilat
12 BREAST-L Breast, Left
13 BREAST-R Breast, Right
14 CALCANEUS-B Calcaneus, Bilat
15 CALCANEUS-L Calcaneus, Left
16 CALCANEUS-R Calcaneus, Right
17 CAROTID Carotid
There was a bunch more of this and then:
149 rows selected.
SQL> spool off;
According to the route.base file, the bodypartcode prefetch rules work off of the CODE field, so I could probably have just exported that one column and been done, but I usually want to take a look at the data in Excel to be confident we are not introducing problems based on the formatting, duplicates that have been marked inactive, etc. This export is pretty basic, but it still never hurts to double-check. I’ll get rid of the description and ID once I think that everything is is in order.
Once I had this in Excel, the most difficult part of this adventure began: actually figuring out which studies we wanted to prefetch for a study type. After much deliberation about Left/Right/Bilateral, and how to pull just what was appropriate, we decided to err on the side of pulling too many studies. They only last for 21 days (adjustable via flush.site) in the cache, so it isn’t a huge deal to have extra ones. So I went into Excel and reduced my list just to show the main body part designator (so where we use HAND-L, HAND-R, and HAND-B, I reduced it to just HAND). Since “HAND” is the beginning of all these side-designated parts, and that model is replicated throughout, we can use the HasPrefix operator for grouping parts. This brought us from 149 body parts to just 77, which is pretty manageable. For the combined exams (Chest/Abd/Pelvis) I made a new designator called TRUNK that will include Chest and Abdomen (Pelvis is a bit weirder becasue it would pull in a bunch of ultrasound studies if it were included, so I did not add it to the grouping (however, by grouping studies based on the starting words, it should pull in the correct studies anyway for MR and CT, since none of the multi-part names start with the word Pelvis)).
I ended up with a list that looked something like this, which I saved as C:\Scripts\bodyparts.txt:
AC-JOINTS
ANKLE
AORTA
AXILLA
BLADDER
BONE-LENGTH
BONE-SURVEY
BRAIN
BREAST
CALCANEUS
CAROTID
CLAVICLE
COCCYX
COLON
ELBOW
To do something really basic, like prefetching the last three studies for a particular body part into a cache2 location, each body part would need an entry in route.site that looks like (where %X designates the bodypart code):
%X.LABEL install "Bodypart %X"
%X.MEMBERSHIP_RULE install bodypartcode EQ %X
%X.prefetch.LOCATIONS install cache2
%X.prefetch.cache2.STUDIES install %X 1 3
Since we are doing this based on the starting characters for the body part, instead of the EQ operator, I am using HasPrefix, and I am pulling 5 relevant instead of 3 because we are being less specific on laterality:
%X.LABEL install "Bodypart %X"
%X.MEMBERSHIP_RULE install bodypartcode HasPrefix %X
%X.prefetch.LOCATIONS install cache2
%X.prefetch.cache2.STUDIES install %X 1 5
The trunk one will be a bit different, since it has two body parts with different names to group together:
TRUNK.LABEL install "Bodypart TRUNK"
TRUNK.MEMBERSHIP_RULE install bodypartcode HasPrefix CHEST or bodypartcode HasPrefix ABDOMEN
TRUNK.prefetch.LOCATIONS install cache2
TRUNK.prefetch.cache2.STUDIES install TRUNK 1 5
The TRUNK setup is a one-off, so I did it by hand. Here is a PowerShell script to create the rest:
$bp = Get-Content C:\Scripts\bodyparts.txt
Foreach ($a in $bp)
{
Write-Host "$a.LABEL install `"Bodypart $a`""
Write-Host "$a.MEMBERSHIP_RULE install bodypartcode HasPrefix $a"
Write-Host "$a.prefetch.LOCATIONS install cache2"
Write-Host "$a.prefetch.cache2.STUDIES install $a 1 5"
Write-Host ""
}
To put this into your config:
- Copy the results of the PowerShell script into route.site
- Put all of the names from bodyparts.txt into the prefetch.GROUPS variable in route.site
- Leave “default” at the end
- Also, you cannot use slashes to break this variable list into multiple lines like you can with almost every other config file; it needs to be one long line
You may be able to enable this by just restarting the route process, but I am not sure. I put it into place during a scheduled downtime, so all processes were being restarted.