Fwd: Barcodes to represent all types of ART visits

0 views
Skip to first unread message

Jeff Rafter

unread,
Nov 3, 2007, 10:29:30 AM11/3/07
to baobab-v...@googlegroups.com
Hey Volunteers,

I wanted to keep you guys posted on whats going on. This is a recent mail from Mike (who presented in Berlin):

I had the idea that we could probably represent all of the types of ART
visits that are possible with a barcode. We would simply brute force all
of the possible answer combinations and then assign a number to each
one. I figured it would be a pain but possible to write the brute
forcing code.  I just happened upon a nice solution thanks to a recent
RubyQuiz:

"Usually, you write a regular expression and then search for it in a
text string. How about doing the opposite? Given a regular expression,
generate all of the strings that it will match."

http://www.rubyquiz.com/quiz143.html

So I took one of the quiz solutions and did the following:

/(Alive|Dead|Defaulter|Stop|Transfer Out) (Start|Substitute|Switch)
(Ambulatory|Not Ambulatory) (At work or school|Not at work or school)
(None |Peripheral Neuropathy |Skin Rash |Hepatitis )+(Given to
patient|Given to guardian)/.generate()

Which returns the 2400 different possible permutations (limiting side
effects to 2 combinations). This is pretty crazy, because we can now
simply make a barcode of the format:

Year|Month|Day|Weight|VisitType|PillCount

YYMMDDWWWWVVVVVVPP

Which is just 18 digits, which is easily encodable in a small Code 128
barcode. I left room for 999,999 different possible visit combinations
(even though we only currently have 2400).

Great Barcode page: http://www.barcodeman.com/faq/2d.php

Of course, this approach can be generalized to all of the data that we
collect. An entire VCT visit represented as one barcode.

I think this clearly shows that we don't need smartcards.

We should probably build this soon. Calling this revolutionary might not
be overstating it...

Footnote:
If we really wanted to push our encoding scheme to the limit we could
add the dates and pill count permutations to the regular expression. I
did that and came up with this:

/(20\d\d)
(January|February|March|April|May|June|July|August|September|November|December)
(0|1|2|3)([0-9]) ([0-9])([0-9])([0-9])
(Alive|Dead|Defaulter|Stop|Transfer Out) (Starter Pack 30|Starter Pack
40|Triomune 30|Triomune 40|Substitute|Switch Adult|Switch Child)
(Ambulatory|Not Ambulatory) (At work or school|Not at work or school)
(None |Peripheral Neuropathy |Skin Rash |Hepatitis
)+([0-9])([0-9])([0-9]) (Given to patient|Given to guardian)/.generate()

It ran for about 5 minutes was consuming more and more memory so I
killed it, but I am sure it would have given us something that uses less
than 18 digits. I believe this gives us an approach to determine the
optimum compression scheme for any set of data. Now we're playing with
power!
Reply all
Reply to author
Forward
0 new messages