Task, Purpose, Method, Effects

“In preparing for battle I have always found that plans are useless, but planning is indispensable.” –Gen. Dwight D. Eisenhower.

When planning for military operations, the Commander’s Intent is detailed in the Mission Statement. This mission statement is designed to emphasize the essential tasks, their purpose, the method for achieving them, and the intended end-state that may be observed in order to evaluate the achievement of effects. While this concept is stressed to junior officers learning about planning processes, it is something that may be (and often subconciously is) applied to any project.

I recently found myself preparing some turnover items for the Officer coming out to relieve me at my current assignment. Personally, I feel one of the items that is critical for a successful turnover is a good contact roster. Unfortunately, I have not kept good records of who I talk to outside of my MS Outlook PST file. The good news is that government workers are really good about putting all of their contact information in the signature block of their emails. So I figured, why not create a Python script that can automatically parses emails down to the relevant contact information? In order to ensure I use my time efficiently, I’ll define it using TPME (task, purpose, method, effects/endstate).

Task: Automatically extract contact information from archived emails.
Purpose: In order to build a contact list of individuals including name, position, email, and phone for my replacement to have handy.
Method: Use Python to ingest email content, parse the message, extract the relevant content, and write it to a CSV file.
Endstate: A csv file with rows of key contacts and columns containing their information.

I even drew up a rough base sketch for mission execution:

FiniteAutomata

It’s the return of my old grad-school nemesis, non-determinanistic Finite Automata. While I wouldn’t turn this in as the answer for an assignment, it does get my to what I believe is an 80% solution, framing the battlefield and the direction of march. This sketch came as a part of my problem analysis, with step one being an export of all of my Outlook emails to an editable csv file. From the body of the emails, I observed that messages generally have the following structure:

[Greeting],

[Body]

[Salutation],
[Signature]

Each of these sections are completely optional, necessitating epsilon-transitions between states.  I do make the assumption that these states occur in sequence. That is, [Greeting] will always come before [Salutation] even if there is no [Body] or [Signature].

Looking through my representative data set I made the following observations about the structure of each state transition:

[Greeting] transitions to [Body], [Salutation], [Signature], or end-of-message [EOM] from the below set of observations:

{“LT,”; “Sir,”; “ALCON,”; “ALL,”; “Leaders,”; “SFC Loudly,”; “Hello shipmates,”; “HQ Admin,”; “Willie,”; “Master Chief,”; “Team Navy,”; “Sirs,”}

Which can be simplified by regular expressions in Python to something like [A-Za-z]+,\n\n?. 

Similarly, the other states transition are observed as follows:

  • [Body] -> [Salutation], [Signature], [EOM]
    {“Please…, let me know.”; “Shop B…contact SPC Good.”; “With numbers filled in.”; “I need…numbers.”; “The DCS….1400 South Conf Rm”; “FYI”; “http://….”; “Go for it”}
    Which looks something like [A-Za-z0-9]+\n\n.
  • [Salutation] -> [Signature], [EOM]
    {“Very Respectfully,”; “V/R,”; “V/R”; “v/r”; “vr”; “r/”; “Thanks,”; “Thank you and Very respectfully,”}
    Which is like [A-Za-z]+,\n.
  • [Signature] -> [EOM]
    {“Name\nAddress?\n?Postion\n?Organization\n?Location\n?Email1\n?Email2\n?Email3\n?Phone1\n?Phone2\n?Phone3\n?\n”Quote”Author\n?}

Which leaves us with a Signature block that needs to be further parsed in order to extract the appropriate data fields. More to follow (MTF).

 

Advertisements

One thought on “Task, Purpose, Method, Effects

  1. Pingback: Be Prepared for the Unexpected | Captain America Develops Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s