Skip to main content

Recording a Booby Observation for Posterity


CC Licensed photo by Rileypie
Building on the database that spurred my Color Considerations, I spent the better part of today debating the best way to log observers in a database. Having documented it to explore the pros and cons with my coworkers, I figured I'd share my musings with y'all as well. What way do you think is best? Is there a better pattern I left out?

OUR EXAMPLE
On a blue-footed booby capture Nov. 11, 2007 we had four biologists recorded on the capture event: Mike, Roy, Phil and Jay.



How do I record this? Let’s review a few options:


OPTION 1
Two Integer Fields to an Observer lookup table
Observer1ID: “272”     (MIKE)
Observer2ID: “312” (ROY)

NEGATIVE: The rest of the observers disappear in the data abyss.




OPTION 2
One Integer Field to an Observer lookup, One Free Text Field
Observer1ID: “272”     (MIKE)
OtherObservers: “ROY, PHIL, JAY”

NEGATIVE: Nothing lost, but only able to reliably query on Observer1… Other Observers are listed, but there is no way to find PHIL. He could be “PHIL, P., PHILLIP, PHILIP, or FILLUP”





OPTION 3
Observation Table linked to Observation_Observer Table by ObservationID

Observation_Observer Table has the following Structure for example record, “123”
ObservationID    ObserverID   Rank
123 272 1
123 312 2
123 21 3
123 128 4

NEGATIVE: The weakness of this model is that it is possible to enter an observation with no observer since enforcing the creation of child record in a database is difficult and one would have to rely on the interface for data integrity. Additionally, querying subtables is just a pain and often done incorrectly by users.





OPTION 4
Modified Option 3 – With Observers assigned roles.
Observation Table linked to Observation_Observer Table by ObservationID

Observation_Observer Table has the following Structure for example record, “123”
ObservationID    ObserverID   RoleID
123 272 1 (Primary Observer)
123 312 2 (Secondary Observer)
123 21 6 (Sample Collector)
123 128 2 (Secondary Observer)

NEGATIVE: This model shares most of the same weaknesses as Option 3. The addition of roles does codify the each of the observer's parts better, but introduces another weakness that no Role is necessarily required. At least in Option 3 one could produce a 1-to-1 relationship by selecting the highest ranked Observer (lowest number) as long as one tested for nulls first.





Option 5
Modified Option 2 & 4 combined – Primary Observer in the Main Table with Secondary Observers in a subtable assigned roles.

Observation Table
PrimaryObserverID: “272”


Observation_Observer Table has the following Structure for example record, “123”
ObservationID    ObserverID   RoleID
123 312 2 (Secondary Observer)
123 21 3 (Sample Collector)
123 128 4 (Secondary Observer)

NEGATIVE: The only weakness of this is that entering secondary observers may be a little tiring over the free text field Option 2. One may also want to consider the ability to enter free text for anecdotal observations rather than creating another Observer record. Perhaps certain applications would enter structured data in the Observation Comment field and the PrimaryObserver would be “Anecdotal – See comments”. For most incidentals however, follow-up is very important making the addition of a new observer an obvious and necessary step so a biologist has a phone number or email to confirm the sighting.


I have my favorite. Which option do you think has the best combination of ease of use and future queryability? Do you have a better design pattern?

Comments

Popular posts from this blog

Attachment Reminder - and more for MS Outlook

I just did it again. We don't like to admit it, but we all have. You write a long letter describing the attachment, press send and then 10 seconds later remember you didn't actually attach the message. I finally decided to do something about it. Turns out it isn't too hard. Chiefly because Jimmy Peña at Code for Excel and Outlook already did all the hard work of writing up an excellent MS Outlook Etiquette Check Macro that does all the dirty work for you. What's left for you to do? In MS Outlook go to Tools > Macros > Visual Basic Editor Under the Project Panel (far left) Browse to Project1 > Microsoft Office Outlook Objects > ThisOutlookSession Double-click ThisOutlookSesson to Open (if you haven't been here before this will be a big blank canvas) Visit Code for Excel and Outlook Etiquette Check Code and select "Copy to Clipboard" at the top of the code. Or you can also copy from the code I've modified below if you prefer.

Auto Format (and Color) Outlook Appointments

A few years ago I got turned on to the idea of indexing your life by color. In a quick glance your mind can comprehend really complex patterns. By coloring entries in my calendar I am able to tell immediately if I am available or if a future appointment conflicts with a work meeting. There are a number of ways to set this up. Outlook allows you to add a label to every appointment. However this is an Outlook specific feature and I sync my calendar across Outlook, Yahoo! and iCalendar. The later two don't even have labels. Besides, calendars should be simple. Complexity only hinders usability, so I prefer an automated solution. How to color appointments in Outlook automatically: In Calendar, right-click the calendar grid, and then click Automatic Formatting on the shortcut menu. Click Add, and then type a name for the rule. In the Label list, click a color. Click Condition to specify the conditions under which the color will be applied. Note: If you manually assign a color to a

Simple HTTP Redirect with Querystring in IIS7

HTTP Redirect seems simple enough. Always was in IIS6 and in IIS7 there's even a button labeled HTTP Redirect that promises relative redirects.  It looks like it'll be as easy Apache finally.  That is until you try to redirect a querystring.  Then everything bombs. Turns out it still is relatively easy, except you have to know that Microsoft changed $S$Q to $V$Q. Why? $Ss and $Gs I suspect. And How. In our example we'll redirect all pages under http://olddomain.com/content to http://mydomain.com/content. Pick the virtual directory you want to redirect. e.g. http://olddomain.com/content Click HTTP Redirect under IIS in the IIS management console. In the HTTP Redirect Dialog: Check Redirect requests to this destination Enter your new path ending with $V$Q.  e.g. http://mydomain.com$V$Q Counter-intuitively check Redirect all request to exact destination (instead of relative destination) Choose the appropriate Status Code (Permanent or Temporary)