Skip to content

Commit

Permalink
Support more and less sophisticated approaches to read the confirmed …
Browse files Browse the repository at this point in the history
…trip count

This now supports both the leaderboard branch and the main branches.
If we have computeConfirmed, we use it.
If we don't have it, we just read the number of trips that are unlabeled. Note
that this does not take into account the high confidence label assist trips, so
it is only approximate, and should be handled better once we improve the
accuracy of label assist.

#873 (comment)

```
./e-mission-py.bash bin/monitor/check_participant_status.py
storage not configured, falling back to sample, default configuration
URL not formatted, defaulting to "Stage_database"
Connecting to database URL localhost:27017
False    4
Name: user_input, dtype: int64
For test_jun_20: Trip count = 6, location count = 285, first trip = 2016-06-20T08:41:15.856000-07:00, last trip = 2016-06-20T17:12:39.767000-07:00, confirmed_pct (2016-05-25T00:00:00+00:00 -> 2016-06-25T00:00:00+00:00) = exactly 66.67
```

```
./e-mission-py.bash bin/monitor/check_participant_status.py
storage not configured, falling back to sample, default configuration
URL not formatted, defaulting to "Stage_database"
Connecting to database URL localhost
For test_jun_20: Trip count = 6, location count = 285, first trip = 2016-06-20T08:41:15.856000-07:00, last trip = 2016-06-20T17:12:39.767000-07:00, confirmed_pct  = approximately 0.67
```
  • Loading branch information
shankari committed Aug 10, 2022
1 parent 89d53bf commit 5694df1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/monitor/check_participant_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
now = arrow.now()
month_ago = now.shift(months=-1)
last_month_tq = estt.TimeQuery("data.start_ts", month_ago.timestamp, now.timestamp)
confirmed_pct, valid_replacement_pct, score = ecwu.User.computeConfirmed(ue["uuid"], last_month_tq)
print(f"For {ue['user_email']}: Trip count = {trip_count}, location count = {location_count}, first trip = {first_trip_time}, last trip = {last_trip_time}, confirmed_pct ({month_ago} -> {now}) = {confirmed_pct:.2f}")
if 'computeConfirmed' in vars(ecwu.User):
confirmed_pct, valid_replacement_pct, score = ecwu.User.computeConfirmed(ue["uuid"], last_month_tq)
print(f"For {ue['user_email']}: Trip count = {trip_count}, location count = {location_count}, first trip = {first_trip_time}, last trip = {last_trip_time}, confirmed_pct ({month_ago} -> {now}) = exactly {confirmed_pct:.2f}")
else:
confirmed_count = edb.get_analysis_timeseries_db().count_documents({"user_id": ue["uuid"], "metadata.key": "analysis/confirmed_trip", "data.user_input": {"$ne": {}}})
confirmed_pct = confirmed_count / trip_count
print(f"For {ue['user_email']}: Trip count = {trip_count}, location count = {location_count}, first trip = {first_trip_time}, last trip = {last_trip_time}, confirmed_pct = approximately {confirmed_pct:.2f}")

0 comments on commit 5694df1

Please sign in to comment.