a pythonic query language
Sign in or create a new account.

S(1@1) R(P@1)
5691.0 Race Unspecified
2600.0 African-American/Black
3653.0 European-American/White
1861.0 Hispanic/Latino
34.0 Pacific Islander
132.0 Native American/Alaskan
190.0 Asian
2.0 European-American/Black
27.0 Middle Eastern
7.0 None
1.0 Pakistani American
1.0 Asian/Pacific Islander
1.0 Unknown Race

Address, Age, CauseOfDeath, City, County, Date, DayOfMillenium, DayOfWeek, Description, ImageURL, LawEnforcementAgency, Month, Name, NewsURL, OfficialDisposition, Prace, Sex, State, SymptomsOfMentalIllness, Year, Zip

The PyQL query format is: fields @ conditions.
  fields is a field or a comma delimited list of fields.
 conditions is a condition or an and delimited list of conditions.

Both fields and conditions are made up of terms.
A term is a valid Python expression in a name space made up of: database parameters; any imported python modules; PyQL Aggregators such as Average (A), Sum (S), and Replace (R); and other domain specific terms.

About the Fatal Encounter DatabaseSample Queries
The Data

This database was download as a spreadsheet from FatalEncounters.org. Brian Burghart maintains this spreadsheet and welcomes your support. You can e-mail Brian d.brian [at] fatalencounters.org.

The first step in importing Brian's spreadsheet into a PyQL database involved taking non-alpha numberic characters out of headers and using them in CamelCase. For example, the spreadsheet header of 'law enforcement agency' becomes the database parameter 'LawEnforcementAgency'.

Agile Access to Database Parameters

The CamelCaseFormatting of database parameters is logical, readable, and verbose. With domain specific query languages you get to make the rules for parameter reference. And here we like: Access parameters by their capitalized letters and fill in lower case letters as needed to remove ambiguity. Like this for getting the the Date,Name,CauseOfDeath,OfficialDisposition, and the Prace (perceived race) for fatal encounters with law enforcement in Multnomah County:

To see the number of fatal encounters with law enforcement for each city in the database, use the PyQL: S(1),R(City)@City

This query form is handy for breakdown by any parameter. To see fatal encounters by state, use the PyQL: S(1),R(St)@St

And likewise for CauseOfDeath, use the PyQL: S(1),R(COD)@COD

And for Prace (perceived race), use the PyQL: S(1),R(P)@P

To see details of all fatal encounters in Portland, Oregon, use the PyQL: Name,Date,COD,OD,SOMI@City='Portland' and State='OR' s.