Skip to content

Commit

Permalink
Add example queries utilizing timestamps info #8
Browse files Browse the repository at this point in the history
  • Loading branch information
JetamZ committed Oct 27, 2024
1 parent 6fa2854 commit 3257b54
Show file tree
Hide file tree
Showing 18 changed files with 354 additions and 180 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"target_databases":["databaseCS"],
"description":"Evolution of speaking pace of the fastest speaker over time of the day.",
"steps":[
{
"goal":"get_fastest_speaker",
"aggregation": {
"group_by":["speech.person_id"],
"order_by":[
{
"column":"AVG((speech.token_count / (speech.total_duration / 60000)))",
"direction":"DESC"
}
]
},
"filtering": {
"columns":["speech.person_id"],
"conditions":[
{
"column":"speech.total_duration",
"operator":">=",
"value":"60000"
}
],
"limit":"1"
}
},
{
"goal":"main",
"aggregation": {
"group_by":["speech.person_id", "speech.earliest_timestamp"],
"order_by":[
{
"column":"speech.earliest_timestamp",
"direction":"ASC"
}
]
},
"filtering": {
"columns":["speech.earliest_timestamp", "AVG((speech.token_count / (speech.total_duration / 60000))) AS average_wpm"],
"conditions": [
{
"column":"speech.total_duration",
"operator":">=",
"value":"60000"
},
{
"column":"speech.person_id",
"operator":"=",
"value":"step_result.get_fastest_speaker.speech.person_id"
}
],
"limit":""
}
}
]
}
29 changes: 29 additions & 0 deletions api/example_queries/queries/fastest_speaking_speakers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"target_databases":["databaseCS"],
"description":" TOP 10 speakers with most words per minute.",
"steps":[
{
"goal":"main",
"aggregation": {
"group_by":["speech.person_id"],
"order_by":[
{
"column":"average_wpm",
"direction":"desc"
}
]
},
"filtering":{
"columns":["speech.person_id", "AVG((speech.token_count / (speech.total_duration / 60000))) AS average_wpm"],
"conditions":[
{
"column":"speech.total_duration",
"operator":">=",
"value":"60000"
}
],
"limit":"10"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"target_databases":["databaseCS"],
"description":"Total duration of members of ANO in miliseconds",
"steps": [
{
"goal":"get_ano_members",
"aggregation" : {
"group_by":["person.person_id", "organisation.organisation_id"],
"order_by":[]
},
"filtering": {
"columns":["person.person_id"],
"conditions": [
{
"column":"organisation.organisation_id",
"operator":"LIKE",
"value":"'%%ANO%%'"
}
],
"limit":""
}
},
{
"goal":"main",
"aggregation": {
"group_by":["affiliation.person_id"],
"order_by":[
{
"column":"total_duration_ms",
"direction":"DESC"
}
]
},
"filtering": {
"columns":["affiliation.person_id", "SUM(speech.total_duration) AS total_duration_ms"],
"conditions": [
{
"column":"affiliation.person_id",
"operator":"IN",
"value":"step_result.get_ano_members.affiliation.person_id"
},
{
"column":"speech.date",
"operator":"<=",
"value":"affiliation.until"
},
{
"column":"speech.date",
"operator":">=",
"value":"affiliation.until"
}
],
"limit":""
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
[{'affiliation.person_id': 'VeraJourova.1964', 'average_named_entity_references': 50.0}, {'affiliation.person_id': 'AndrejBabis.1954', 'average_named_entity_references': 47.0}, {'affiliation.person_id': 'PatrikNacher.1974', 'average_named_entity_references': 42.0}, {'affiliation.person_id': 'JanaMrackovaVildumetzova.1973', 'average_named_entity_references': 21.2}, {'affiliation.person_id': 'JaroslavFaltynek.1962', 'average_named_entity_references': 16.666666666666668}, {'affiliation.person_id': 'MonikaOborna.1989', 'average_named_entity_references': 14.5}, {'affiliation.person_id': 'JosefHajek.1956', 'average_named_entity_references': 14.5}, {'affiliation.person_id': 'BronislavSchwarz.1966', 'average_named_entity_references': 12.5}, {'affiliation.person_id': 'AlenaSchillerova.1964', 'average_named_entity_references': 10.0}, {'affiliation.person_id': 'RadimHolis.1975', 'average_named_entity_references': 9.0}, {'affiliation.person_id': 'HelenaValkova.1951', 'average_named_entity_references': 8.75}, {'affiliation.person_id': 'JosefKott.1970', 'average_named_entity_references': 7.833333333333333}, {'affiliation.person_id': 'MiloslavJanulik.1962', 'average_named_entity_references': 7.666666666666667}, {'affiliation.person_id': 'KristynaZelienkova.1974', 'average_named_entity_references': 6.0}, {'affiliation.person_id': 'KlaraDostalova.1971', 'average_named_entity_references': 5.538461538461538}, {'affiliation.person_id': 'TatanaMala.1981', 'average_named_entity_references': 4.666666666666667}, {'affiliation.person_id': 'MilanHnilicka.1973', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'IvanPilny.1944', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'JiriHlavaty.1948', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'RomanKubicek.1963', 'average_named_entity_references': 3.0}, {'affiliation.person_id': 'PetrSadovsky.1969', 'average_named_entity_references': 3.0}, {'affiliation.person_id': 'JaroslavaPokornaJermanova.1970', 'average_named_entity_references': 2.0}, {'affiliation.person_id': 'RadekVondracek.1973', 'average_named_entity_references': 1.5}, {'affiliation.person_id': 'BerenikaPestova.1971', 'average_named_entity_references': 1.5}, {'affiliation.person_id': 'DanTok.1959', 'average_named_entity_references': 1.0}, {'affiliation.person_id': 'MilanBrazdil.1962', 'average_named_entity_references': 1.0}, {'affiliation.person_id': 'RadkaMaxova.1968', 'average_named_entity_references': 0.0}, {'affiliation.person_id': 'VeraAdamkova.1954', 'average_named_entity_references': 0.0}]
[{'affiliation.person_id': 'VeraJourova.1964', 'average_named_entity_references': 50.0}, {'affiliation.person_id': 'AndrejBabis.1954', 'average_named_entity_references': 47.0}, {'affiliation.person_id': 'PatrikNacher.1974', 'average_named_entity_references': 42.0}, {'affiliation.person_id': 'JaroslavFaltynek.1962', 'average_named_entity_references': 16.666666666666668}, {'affiliation.person_id': 'JosefHajek.1956', 'average_named_entity_references': 14.5}, {'affiliation.person_id': 'MonikaOborna.1989', 'average_named_entity_references': 14.5}, {'affiliation.person_id': 'BronislavSchwarz.1966', 'average_named_entity_references': 12.5}, {'affiliation.person_id': 'AlenaSchillerova.1964', 'average_named_entity_references': 10.0}, {'affiliation.person_id': 'RadimHolis.1975', 'average_named_entity_references': 9.0}, {'affiliation.person_id': 'HelenaValkova.1951', 'average_named_entity_references': 8.75}, {'affiliation.person_id': 'JosefKott.1970', 'average_named_entity_references': 7.833333333333333}, {'affiliation.person_id': 'MiloslavJanulik.1962', 'average_named_entity_references': 7.666666666666667}, {'affiliation.person_id': 'KristynaZelienkova.1974', 'average_named_entity_references': 6.0}, {'affiliation.person_id': 'KlaraDostalova.1971', 'average_named_entity_references': 5.538461538461538}, {'affiliation.person_id': 'TatanaMala.1981', 'average_named_entity_references': 4.666666666666667}, {'affiliation.person_id': 'MilanHnilicka.1973', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'JanaMrackovaVildumetzova.1973', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'JiriHlavaty.1948', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'IvanPilny.1944', 'average_named_entity_references': 4.0}, {'affiliation.person_id': 'RomanKubicek.1963', 'average_named_entity_references': 3.0}, {'affiliation.person_id': 'PetrSadovsky.1969', 'average_named_entity_references': 3.0}, {'affiliation.person_id': 'JaroslavaPokornaJermanova.1970', 'average_named_entity_references': 2.0}, {'affiliation.person_id': 'RadekVondracek.1973', 'average_named_entity_references': 1.5}, {'affiliation.person_id': 'BerenikaPestova.1971', 'average_named_entity_references': 1.5}, {'affiliation.person_id': 'DanTok.1959', 'average_named_entity_references': 1.0}, {'affiliation.person_id': 'MilanBrazdil.1962', 'average_named_entity_references': 1.0}, {'affiliation.person_id': 'RadkaMaxova.1968', 'average_named_entity_references': 0.0}, {'affiliation.person_id': 'VeraAdamkova.1954', 'average_named_entity_references': 0.0}]

+--------------------------------+---------------------------------+
| affiliation.person_id | average_named_entity_references |
+--------------------------------+---------------------------------+
| VeraJourova.1964 | 50.0 |
| AndrejBabis.1954 | 47.0 |
| PatrikNacher.1974 | 42.0 |
| JanaMrackovaVildumetzova.1973 | 21.2 |
| JaroslavFaltynek.1962 | 16.666666666666668 |
| MonikaOborna.1989 | 14.5 |
| JosefHajek.1956 | 14.5 |
| MonikaOborna.1989 | 14.5 |
| BronislavSchwarz.1966 | 12.5 |
| AlenaSchillerova.1964 | 10.0 |
| RadimHolis.1975 | 9.0 |
Expand All @@ -20,8 +19,9 @@
| KlaraDostalova.1971 | 5.538461538461538 |
| TatanaMala.1981 | 4.666666666666667 |
| MilanHnilicka.1973 | 4.0 |
| IvanPilny.1944 | 4.0 |
| JanaMrackovaVildumetzova.1973 | 4.0 |
| JiriHlavaty.1948 | 4.0 |
| IvanPilny.1944 | 4.0 |
| RomanKubicek.1963 | 3.0 |
| PetrSadovsky.1969 | 3.0 |
| JaroslavaPokornaJermanova.1970 | 2.0 |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
[{'affiliation.role': 'deputyHead', 'average_sentence_count': 6.296012975911273}, {'affiliation.role': 'member', 'average_sentence_count': 6.277422307657101}, {'affiliation.role': 'representative', 'average_sentence_count': 6.305979337294578}, {'affiliation.role': 'verifier', 'average_sentence_count': 6.327535906642729}, {'affiliation.role': 'head', 'average_sentence_count': 6.295505125733812}]
[{'affiliation.role': 'deputyHead', 'average_sentence_count': 6.246553140472014}, {'affiliation.role': 'member', 'average_sentence_count': 6.239004233762873}, {'affiliation.role': 'representative', 'average_sentence_count': 6.265916590036242}, {'affiliation.role': 'verifier', 'average_sentence_count': 6.243060334939206}, {'affiliation.role': 'head', 'average_sentence_count': 6.244799432019879}]

+------------------+------------------------+
| affiliation.role | average_sentence_count |
+------------------+------------------------+
| deputyHead | 6.296012975911273 |
| member | 6.277422307657101 |
| representative | 6.305979337294578 |
| verifier | 6.327535906642729 |
| head | 6.295505125733812 |
+------------------+------------------------+
[{'affiliation.role': 'member', 'average_sentence_count': 3.258727368606082}]

+------------------+------------------------+
| affiliation.role | average_sentence_count |
+------------------+------------------------+
| member | 3.258727368606082 |
| deputyHead | 6.246553140472014 |
| member | 6.239004233762873 |
| representative | 6.265916590036242 |
| verifier | 6.243060334939206 |
| head | 6.244799432019879 |
+------------------+------------------------+
17 changes: 4 additions & 13 deletions api/example_queries/results/average_tokens_by_position_result.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
[{'average_tokens': 18.241933321143414, 'speech.role': 'chair'}, {'average_tokens': 239.03225806451613, 'speech.role': 'guest'}, {'average_tokens': 91.23050163147671, 'speech.role': 'regular'}]
[{'average_tokens': 447.41302235179785, 'speech.role': 'guest'}, {'average_tokens': 262.9682086742366, 'speech.role': 'regular'}, {'average_tokens': 54.36446967652388, 'speech.role': 'chair'}]

+--------------------+-------------+
| average_tokens | speech.role |
+--------------------+-------------+
| 18.241933321143414 | chair |
| 239.03225806451613 | guest |
| 91.23050163147671 | regular |
| 447.41302235179785 | guest |
| 262.9682086742366 | regular |
| 54.36446967652388 | chair |
+--------------------+-------------+
[{'average_tokens': 452.1521328803322, 'speech.role': 'guest'}, {'average_tokens': 266.9352142475181, 'speech.role': 'regular'}, {'average_tokens': 55.23546464501979, 'speech.role': 'chair'}]

+-------------------+-------------+
| average_tokens | speech.role |
+-------------------+-------------+
| 452.1521328803322 | guest |
| 266.9352142475181 | regular |
| 55.23546464501979 | chair |
+-------------------+-------------+
Loading

0 comments on commit 3257b54

Please sign in to comment.