Event Query Language is a search language for ordered datasets. Event Query Language allows you to search such datasets for relationships between events.
Event Query Language implements this by allowing relative search terms between events. Eg:
- Find all events with a Description containing 'dog' and events with a Description containing 'cat' that have a Starttime after the previous event
- Find all events with a Description containing 'cat' and find all events with a Description containing 'dog' that have the same Count as the previous event
Such linked events are returned as entire sequences that fulfill the search criteria.
Eventlist:
[{EventID: 1, Description: cat, starttime: 12am, count: 5},
{EventID: 2, Description: cat, starttime: 3pm, count: 1},
{EventID: 3, Description: dog, starttime: 9am, count: 5},
{EventID: 4, Description: dog, starttime: 6pm, count: 1}]
The EventIDs of the events that the 1st search returns:
- [1, 3]
- [2, 3]
The EventIDs of the events that the 2nd search returns:
- [1, 3]
- [2, 4]
Download eventsearch.py and place it in your working directory, simply import eventsearch to access the methods output.py is required for the testing script only
To use Event Query Language, you must format your events as a dictionary:
{Descriptor: Value, Descriptor: Value}
Dates must be stored as python's datetime.datetime format. String values are not case sensitive.
Events are then packaged into a list of events to form an eventlist.
The two main functions of Event Query Language are the methods Evaluate and Translate.
Evaluate takes an eventlist and three synchronized lists called queries, connectors and gets.
Translate implements a simple syntax to turn a human readable string into the lists of queries, connectors and gets that Evaluate requires.
Translate and Evaluate operate independently.
Translate separates words by spacebar and uses ALLCAPS to find keywords, underscores are turned into spacebars after the words have been split. Here are a few examples of a string that Translate parses:
This searchstring finds all possible combinations of events with description "intracranial hypertension" and events with a description "endadmission". ALLCAPS keywords that are not reserved by Translate are used to find a descriptor in your events.
DESCRIPTION intracranial_hypertension
AND DESCRIPTION endadmission
ENDSEARCH
Relationships between events use the ASPREVIOUS keyword, this refers to the event directly previous to this event by default (the same as ASPREVIOUS-1).
DESCRIPTION intracranial
NOT AND DESCRIPTION intracranial
COUNT ASPREVIOUS GREATERTHAN COUNT
ENDSEARCH
Special followedby and precededby keywords allow easy linking using a starttime descriptor; without having to explicitly write out the relationships.
DESCRIPTION intracranial
FOLLOWEDBY DESCRIPTION obesity
ENDSEARCH
Compared with:
DESCRIPTION intracranial
AND DESCRIPTION obesity
STARTTIME ASPREVIOUS AFTER STARTTIME
NOT UUID ASPREVIOUS UUID
ENDSEARCH
Searches can be nested inside brackets, criteria applied to the bracket will apply to all events returned from inside the bracket.
DESCRIPTION intracranial
FOLLOWEDBY (
DESCRIPTION obesity
FOLLOWEDBY TEST ferritin
)
OR FOLLOWEDBY DESCRIPTION endadmission
ENDSEARCH
event-query-language's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.