« | » Main « | »


Saturday 23 November 2013

tl;dr: I had half my thyroid removed. I'm fine. It's a big experience.

Back in September, I noticed a bulge in my neck. It wasn't noticeable until I swallowed, it moved up and down with my adam's apple. It didn't bother me in any way, but was big enough to see in a mirror.

I called the doctor, and he said, "Come in today," which was a bit alarming. He checked it out and pronounced it "odd, but not sinister," and explained that it was something on my thyroid gland, that it's not uncommon, and rarely turns out to be bad. And that even if it is cancer, it's one of the treatable kinds of cancer. Still, yikes!

He sent me to get an ultrasound so we could see what it was. This would be the theme for this whole adventure: probably not bad, but let's do some more checking. On the one hand, I was getting reassured, and on the other, I had another doctor or procedure to deal with. The possibility of a bad outcome, which was small and kept getting smaller, was always still there, the procedures tended to be unpleasant, and the steady rhythm of doctor's appointments was a disruption to my treasured routine.

The ultrasound was simple but scary for what it might tell us. Also the technician had an unusual bedside manner, declaring that my thyroid was "ratty." Nice.

The GP said the ultrasound showed a 4-centimeter nodule on my thyroid, though nothing bad seemed to be in it. He referred me to an ear, nose and throat specialist, on the theory that even if it was totally benign, we'd want to take it out.

The ear, nose and throat guy cheerfully confirmed my GP's thinking, and sent me to get a needle biopsy.

A needle biopsy involves using a needle to extract tissue or fluid from some mysterious thing in your body. I lay on a table, they numbed a spot on my neck, and then sucked goop out of me by sticking a vacuum-equipped needle into my neck five times. As with many things like this, thinking about it is worse than actually experiencing it.

In this case, although it didn't hurt, I could feel a dull poking feeling in my neck, and knew that a needle was involved, and I could hear the disgusting slurping noise as the goop was collected. Also, there was the part where the doctor and the technician were saying things like, "is it going? no, it's stuck, pull harder." Ick.

But even there in the room, the doctor said that there were good signs (including the difficulty getting the goop to flow) which were reducing the "bad" chance even further. Good. Now they send the goop off to be tested, and we wait to hear back about the tests.

A week later, the tests came back fine, and it's time to schedule surgery, a hemithyroidectomy, the removal of half my thyroid. The surgery is for two reasons: first, so they can truly examine every bit of the nodule for bad stuff, and second, because it won't go away by itself, and it's better not to have something like that inside you.

The operation makes me anxious: will it be difficult? And will it change me in some important way? Will I be less somehow?

At work, people are excited that I'll have a scar, and I say I already have a scar. "Really, where?" Somehow they haven't noticed the one in the center of my forehead! I guess they really do fade over time.

As you might imagine, surgery is a really big deal. It's kind of routine these days, but when it's actually happening to you, it's pretty involved. The week before the big day, I went to visit the pre-op nurse. She ran me through a long checklist of questions. There were the usual medical things, do you smoke, how often do you drink, are you allergic to anything, have you ever had a bad reaction to anesthesia, etc. I answered no except where the good answer was yes. I apologized to the nurse for being boring, and she laughed and said boring was good. There were also some unusual questions like what is your preferred learning style (verbal, written, visual), which they ask so they know how best to instruct you for post-op tasks.

It was all very thorough, and I felt well cared for. She gave me a bottle of soap to use in the shower for three days before the surgery. The soap was to combat MRSA infections, which I hear are a big deal, so I did as I was told. Also, no food or water the day of surgery, and don't bring any valuables to the hospital, not even a wedding ring.

The big day arrives, and I've been scheduled for a late start time (12:30), so I don't have to get to the hospital until 11, so I bide my time not eating or drinking with hacking on a memory-dump analysis tool we're using to try to find some memory problems: memsee.

Once at the hospital, we begin the pre-op process, which amounts to getting into a hospital gown, and lying in bed in a cubicle. Other cubicles have other pre-op patients. There's a lot of waiting for the next nurse to come around, and I can hear the patient across from me going through her process. Remember the pre-op quiz where I answered no to everything? Sounds like she answered yes to everything, and the doctors and nurses are having a huddle to decide how to deal with it all. I'm glad to be boring...

The nurses help me settle in. The doctor comes by to say hi and draw on my neck where he'll be cutting. The anesthesiologist comes to give me a nausea-suppressing patch behind my ear.

One of the things you get used to through all of this is that people are constantly double-checking that you're the right person by asking you your name and birthday. After over an hour of talking to a handful of different nurses and the doctor and the anesthesiologist, one more nurse comes over and says, "is Ned your given name?" I think she's just chatting, so I answer (truthfully), "no, it's Edward." She immediately spins around and calls out, "You know this isn't his real name!?" And another nurse comes over all aggravated and mutters about how she might have to redo all the paperwork, which is a half-inch binder full of forms and information.

We wait with that unexpected uncertainty for about 45 minutes, and finally a nice administrative person comes by to say that everything is fine, they'll add a note to the binder, and we can proceed. It's about 1:30 by now.

Then suddenly things go fast. The anesthesiologist comes to wheel me to the operating room. I get a quick look around, and it seems like a much more pedestrian room than I expected, but I scooch from the bed to the table, and people are fussing around me, and I remember someone fiddling with my feet (they use some kind of circulation-enhancing boots), and that's all I remember.

One of the side effects of general anesthesia is amnesia: you don't remember the short period of awake time before you really go under, and you don't remember the short period of awake time after you actually wake up. So there's time where I was aware and talking to people in the operating room that are just lost to me. Weird.

Next thing I know, I am in bed feeling groggy. Susan comes in, and I can have ginger ale and saltines. She had brought a crossword puzzle, so we pass the time, her asking me clues and me trying to give her words. After hanging out there for about 90 minutes, the nurses look me over, and make sure I'm coming out of it OK. By the end of it, I'm light-headed, but can sit up and put on my clothes with help. The nurse insists on putting on my shoes and socks so I don't have to bend over, but one of them feels funny so I redo it. She comments on how I insist on fixing it, with a mixture of dismay and admiration, so she knows we're good to go home.

We get home after dinner, and I just want to lie around. My son Ben looks at me funny like I'm acting weird which is fine, I probably am. The scar is two inches long, horizontal, just below the neckline extending to the right from my jugular notch. It's scary and red, and covered with glue (!), but doesn't hurt. My throat is sore, I think mostly from the tube they put down my throat.

I have five days at home to recover, including the Veteran's Day holiday. Susan pampers me, promising as much pie as I want! Nat was a little concerned about the change in me and in the routine. His Facebook summary of the situation: "Dad got sik".

Tuesday I can go back to work, though I still feel a bit like I had Nyquil the night before. My head is just a touch light-headed, and my throat is still a little tender, but somehow the incision never hurt. How can "a guy attack me with a knife" (as I described the procedure a few times) and it doesn't hurt?

We go to see the specialist one last time to hear about the final pathology reports on the removed nodule. He starts off with, "The good news is, the pathology reports are fine, ..." and proceeds to tell us all sorts of details about what they found in the thing, none of which were bad. But he had said, "the good news is," so the whole time, Susan and I are both thinking, what's part B?

She finally asks him, "is there any bad news?" No, he says, there isn't any bad news. He doesn't know how to English as well as he knows how to surgery!

Now, two weeks after the operation, the scar is healing great, and everything is back to normal. My thyroid hormone levels seem fine, so I don't even need to take a synthetic replacement.

The whole process was a mixture of dread and anxiety about what might happen in the long term (will I have a horrible diagnosis?) and dread and anxiety about what might happen in the short term (will this hurt?). Of course, this was fairly minor in the scheme of things, and there are far worse problems. But it made me stop and consider, and it was something Susan and I had to deal with together, which we did well.

Now that it's over, lots of my fears didn't come to pass. I'm the same person I was before, and I feel fine. There's no lasting effect, except for a scar, which will fade with time.

I'm glad to be healthy, I'm glad to have it behind me, and I'll be glad to show you my scars.

Ad-hoc data breakpoints

Sunday 10 November 2013

A co-worker had a problem running a large test suite with nose. Modules were being imported from the wrong directory. Somehow, sys.path was having a "project/lib" directory stuffed into it, and we couldn't figure out why. (tl;dr: it was nose's fault, and we should have known about it, and it shouldn't have been doing it in the first place.)

We searched our code for "sys.path.insert" and found more of them than we liked, but none of them accounted for the modification we were seeing. What we wanted was to run the tests in a debugger, with a data breakpoint set: stop when sys.path is modified.

Unfortunately, pdb doesn't support breakpoints like that, maybe other debuggers do? So we whipped up an ad-hoc data breakpoint:

import pdb, sys

def trace(frame, event, arg):
    if sys.path[0].endswith("lib"):
    return trace


(Yes, it's a little irksome that there are two different spellings of "set trace" there...)

A trace function is a Python function registered with the interpreter with sys.settrace(). This function will be called for every line of Python executed. Trace functions are the basis of debuggers, profilers, and code coverage tools.

Here we've written a very simple one: check to see if sys.path has been modified in the way we care about, and if so, break into the debugger. To be honest, I wasn't quite sure what would happen if I tried to break into the debugger from inside a trace function, but when we ran the test suite with this code in place, it worked perfectly. We were dropped into the debugger just after nose added a "lib" directory to sys.path.

As it happens, nose tries to be helpful by adding a "src" and "lib" directory to the path, even though that's an unusual layout for Python projects. Luckily, there's a nose option to disable that bit of helpfulness, and our tests run just fine now.

If you find yourself in a similar situation, consider a simple trace function. It's an advanced technique, but you don't have to get too tricky, and can really tell you a lot about what your program is doing.

« | » Main « | »