Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions report/benchmarks/bus-analytics/1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# Vehicles on the road per day

cat $INPUT_FILE | sed 's/T..:..:..//' | cut -d ',' -f 1,3 | sort -u | cut -d ',' -f 1 | sort | uniq -c | awk -v OFS="\t" "{print \$2,\$1}"
12 changes: 12 additions & 0 deletions report/benchmarks/bus-analytics/2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Days a vehicle is on the road

cat $INPUT_FILE |
sed 's/T..:..:..//' |
cut -d ',' -f 3,1 |
sort -u |
cut -d ',' -f 2 |
sort |
uniq -c |
sort -k1n |
awk -v OFS="\t" "{print \$2,\$1}"
12 changes: 12 additions & 0 deletions report/benchmarks/bus-analytics/3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Hours each vehicle is on the road

cat $INPUT_FILE |
sed 's/T\(..\):..:../,\1/' |
cut -d ',' -f 1,2,4 |
sort -u |
cut -d ',' -f 3 |
sort |
uniq -c |
sort -k1n |
awk -v OFS="\t" "{print \$2,\$1}"
11 changes: 11 additions & 0 deletions report/benchmarks/bus-analytics/4.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Hours monitored each day

cat $INPUT_FILE |
sed 's/T\(..\):..:../,\1/' |
cut -d ',' -f 1,2 |
sort -u |
cut -d ',' -f 1 |
sort |
uniq -c |
awk -v OFS="\t" "{print \$2,\$1}"
18 changes: 18 additions & 0 deletions report/benchmarks/bus-analytics/5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Hours each bus is active each day

# Records are day, hour, line, bus
<$INPUT_FILE sed 's/T\(..\):..:../,\1/' | awk -F, '
!seen[$1 $2 $4] { seen[$1 $2 $4] = 1; hours[$1 $4]++; bus[$4] = 1; day[$1] = 1; }
END {
PROCINPUT_FILEFO["sorted_in"] = "@ind_str_asc"
for (d in day)
printf("\t%s", d);
printf("\n");
for (b in bus) {
printf("%s", b);
for (d in day)
printf("\t%s", hours[d b]);
printf("\n");
}
}' > out
9 changes: 9 additions & 0 deletions report/benchmarks/bus-analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Mass-Transport System Analytics

This set of scripts script is part of [a recent study on OASA](https://insidestory.gr/article/noymera-leoforeia-athinas) from Diomidis Spinellis and Eleftheria Tsaliki. OASA is the the mass-transport system supporting the city of Athens.

1. `1.sh`: Vehicles on the road per day
2. `2.sh`: Days a vehicle is on the road
3. `3.sh`: Hours each vehicle is on the road
4. `4.sh`: Hours monitored each day
5. `5.sh`: Hours each bus is active each day
61 changes: 61 additions & 0 deletions report/benchmarks/bus-analytics/full.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

# full bus analytics script

# 1.sh Vehicles on the road per day
cat $INPUT_FILE |
sed 's/T..:..:..//' |
cut -d ',' -f 1,3 |
sort -u |
cut -d ',' -f 1 |
sort |
uniq -c |
awk -v OFS="\t" "{print \$2,\$1}"

# 2.sh Days a vehicle is on the road
cat $INPUT_FILE |
sed 's/T..:..:..//' |
cut -d ',' -f 3,1 |
sort -u |
cut -d ',' -f 2 |
sort |
uniq -c |
sort -k1n |
awk -v OFS="\t" "{print \$2,\$1}"

# 3.sh Hours each vehicle is on the road
cat $INPUT_FILE |
sed 's/T\(..\):..:../,\1/' |
cut -d ',' -f 1,2,4 |
sort -u |
cut -d ',' -f 3 |
sort |
uniq -c |
sort -k1n |
awk -v OFS="\t" "{print \$2,\$1}"

# 4.sh -- Hours monitored each day
cat $INPUT_FILE |
sed 's/T\(..\):..:../,\1/' |
cut -d ',' -f 1,2 |
sort -u |
cut -d ',' -f 1 |
sort |
uniq -c |
awk -v OFS="\t" "{print \$2,\$1}"

# 5.sh -- Records are day, hour, line, bus
<$INPUT_FILE sed 's/T\(..\):..:../,\1/' | awk -F, '
!seen[$1 $2 $4] { seen[$1 $2 $4] = 1; hours[$1 $4]++; bus[$4] = 1; day[$1] = 1; }
END {
PROCINPUT_FILEFO["sorted_in"] = "@ind_str_asc"
for (d in day)
printf("\t%s", d);
printf("\n");
for (b in bus) {
printf("%s", b);
for (d in day)
printf("\t%s", hours[d b]);
printf("\n");
}
}' > out
Loading