{"action":"created","comment":{"url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/comments/240077337","pull_request_review_id":183021885,"id":240077337,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDA3NzMzNw==","diff_hunk":"@@ -0,0 +1,97 @@\n+from operator import itemgetter\n+from itertools import groupby\n+\n+DEFAULT_CONFIDENCE = 0.85\n+FALSE_POSITIVE = \"false-positive\"\n+UNIDENTIFIED = \"unidentified\"\n+MULTIPLE = \"multiple animals\"\n+STATUS = \"status\"\n+CLARITY = \"clarity\"\n+\n+MESSAGE = 'message'\n+CONFIDENCE = 'confidence'\n+FALSE_POSITIVE_TAG = {\"event\": \"false positive\", CONFIDENCE: DEFAULT_CONFIDENCE}\n+\n+\n+def calculate_tags(tracks, conf):\n+  # No tracks found so tag as FALSE_POSITIVE\n+  tags = {}\n+  if not tracks:\n+    tags[FALSE_POSITIVE] = FALSE_POSITIVE_TAG\n+    return tags\n+\n+  toBeTagged, unknowns = findSignificantTracks(tracks, conf)\n+\n+  # definites\n+  sortedTags = sorted(toBeTagged, key=itemgetter(\"label\"))\n+  for label, label_tracks in groupby(toBeTagged, itemgetter(\"label\")):\n+    confidence = max(t[CONFIDENCE] for t in label_tracks)\n+    tags[label] = {CONFIDENCE: confidence}\n+\n+  # unknowns\n+  for track in unknowns:\n+    if track[CLARITY] > .5 * conf.min_tag_clarity / 2 and track[\"label\"] in tags:\n+      continue  # other tracks have same animal so lets assume it's correct\n+    else:\n+      # there might be something else going on here...\n+      tags[UNIDENTIFIED] = {CONFIDENCE: DEFAULT_CONFIDENCE}\n+      break\n+\n+  if len(tags) == 0:\n+    tags[FALSE_POSITIVE] = FALSE_POSITIVE_TAG\n+  else:\n+    multipleConfidence = multipleAnimalConfidence(toBeTagged, unknowns)\n+    if multipleConfidence > conf.min_confidence:\n+      tags[MULTIPLE] = {\"event\": MULTIPLE, CONFIDENCE: multipleConfidence}\n+\n+  print(tags)\n+  return tags\n+\n+\n+def findSignificantTracks(tracks, conf):","path":"processing/tagger.py","position":51,"original_position":51,"commit_id":"6317ae33945a22ba96474e0b54bdc35d9759e2ec","original_commit_id":"6317ae33945a22ba96474e0b54bdc35d9759e2ec","user":{"login":"mjs","id":14993,"node_id":"MDQ6VXNlcjE0OTkz","avatar_url":"https://avatars0.githubusercontent.com/u/14993?v=4","gravatar_id":"","url":"https://api.github.com/users/mjs","html_url":"https://github.com/mjs","followers_url":"https://api.github.com/users/mjs/followers","following_url":"https://api.github.com/users/mjs/following{/other_user}","gists_url":"https://api.github.com/users/mjs/gists{/gist_id}","starred_url":"https://api.github.com/users/mjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjs/subscriptions","organizations_url":"https://api.github.com/users/mjs/orgs","repos_url":"https://api.github.com/users/mjs/repos","events_url":"https://api.github.com/users/mjs/events{/privacy}","received_events_url":"https://api.github.com/users/mjs/received_events","type":"User","site_admin":false},"body":"this should be `find_significant_tracks`","created_at":"2018-12-10T03:40:21Z","updated_at":"2018-12-10T03:54:29Z","html_url":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34#discussion_r240077337","pull_request_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/comments/240077337"},"html":{"href":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34#discussion_r240077337"},"pull_request":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34","id":237186774,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM3MTg2Nzc0","html_url":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34","diff_url":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34.diff","patch_url":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34.patch","issue_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/34","number":34,"state":"open","locked":false,"title":"Changed how it decides which animal(s) is(are) in the thermal video","user":{"login":"clare","id":57052,"node_id":"MDQ6VXNlcjU3MDUy","avatar_url":"https://avatars3.githubusercontent.com/u/57052?v=4","gravatar_id":"","url":"https://api.github.com/users/clare","html_url":"https://github.com/clare","followers_url":"https://api.github.com/users/clare/followers","following_url":"https://api.github.com/users/clare/following{/other_user}","gists_url":"https://api.github.com/users/clare/gists{/gist_id}","starred_url":"https://api.github.com/users/clare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clare/subscriptions","organizations_url":"https://api.github.com/users/clare/orgs","repos_url":"https://api.github.com/users/clare/repos","events_url":"https://api.github.com/users/clare/events{/privacy}","received_events_url":"https://api.github.com/users/clare/received_events","type":"User","site_admin":false},"body":"Also includes a multiple animal tag - we shall see how useful this really is...","created_at":"2018-12-10T03:22:08Z","updated_at":"2018-12-10T03:54:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcdc5849768de9ce1cce826ae0b388399b0852b7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34/commits","review_comments_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34/comments","review_comment_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/34/comments","statuses_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/statuses/6317ae33945a22ba96474e0b54bdc35d9759e2ec","head":{"label":"clare:track_metadata","ref":"track_metadata","sha":"6317ae33945a22ba96474e0b54bdc35d9759e2ec","user":{"login":"clare","id":57052,"node_id":"MDQ6VXNlcjU3MDUy","avatar_url":"https://avatars3.githubusercontent.com/u/57052?v=4","gravatar_id":"","url":"https://api.github.com/users/clare","html_url":"https://github.com/clare","followers_url":"https://api.github.com/users/clare/followers","following_url":"https://api.github.com/users/clare/following{/other_user}","gists_url":"https://api.github.com/users/clare/gists{/gist_id}","starred_url":"https://api.github.com/users/clare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clare/subscriptions","organizations_url":"https://api.github.com/users/clare/orgs","repos_url":"https://api.github.com/users/clare/repos","events_url":"https://api.github.com/users/clare/events{/privacy}","received_events_url":"https://api.github.com/users/clare/received_events","type":"User","site_admin":false},"repo":{"id":157619732,"node_id":"MDEwOlJlcG9zaXRvcnkxNTc2MTk3MzI=","name":"cacophony-processing","full_name":"clare/cacophony-processing","private":false,"owner":{"login":"clare","id":57052,"node_id":"MDQ6VXNlcjU3MDUy","avatar_url":"https://avatars3.githubusercontent.com/u/57052?v=4","gravatar_id":"","url":"https://api.github.com/users/clare","html_url":"https://github.com/clare","followers_url":"https://api.github.com/users/clare/followers","following_url":"https://api.github.com/users/clare/following{/other_user}","gists_url":"https://api.github.com/users/clare/gists{/gist_id}","starred_url":"https://api.github.com/users/clare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clare/subscriptions","organizations_url":"https://api.github.com/users/clare/orgs","repos_url":"https://api.github.com/users/clare/repos","events_url":"https://api.github.com/users/clare/events{/privacy}","received_events_url":"https://api.github.com/users/clare/received_events","type":"User","site_admin":false},"html_url":"https://github.com/clare/cacophony-processing","description":null,"fork":true,"url":"https://api.github.com/repos/clare/cacophony-processing","forks_url":"https://api.github.com/repos/clare/cacophony-processing/forks","keys_url":"https://api.github.com/repos/clare/cacophony-processing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clare/cacophony-processing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clare/cacophony-processing/teams","hooks_url":"https://api.github.com/repos/clare/cacophony-processing/hooks","issue_events_url":"https://api.github.com/repos/clare/cacophony-processing/issues/events{/number}","events_url":"https://api.github.com/repos/clare/cacophony-processing/events","assignees_url":"https://api.github.com/repos/clare/cacophony-processing/assignees{/user}","branches_url":"https://api.github.com/repos/clare/cacophony-processing/branches{/branch}","tags_url":"https://api.github.com/repos/clare/cacophony-processing/tags","blobs_url":"https://api.github.com/repos/clare/cacophony-processing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clare/cacophony-processing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clare/cacophony-processing/git/refs{/sha}","trees_url":"https://api.github.com/repos/clare/cacophony-processing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clare/cacophony-processing/statuses/{sha}","languages_url":"https://api.github.com/repos/clare/cacophony-processing/languages","stargazers_url":"https://api.github.com/repos/clare/cacophony-processing/stargazers","contributors_url":"https://api.github.com/repos/clare/cacophony-processing/contributors","subscribers_url":"https://api.github.com/repos/clare/cacophony-processing/subscribers","subscription_url":"https://api.github.com/repos/clare/cacophony-processing/subscription","commits_url":"https://api.github.com/repos/clare/cacophony-processing/commits{/sha}","git_commits_url":"https://api.github.com/repos/clare/cacophony-processing/git/commits{/sha}","comments_url":"https://api.github.com/repos/clare/cacophony-processing/comments{/number}","issue_comment_url":"https://api.github.com/repos/clare/cacophony-processing/issues/comments{/number}","contents_url":"https://api.github.com/repos/clare/cacophony-processing/contents/{+path}","compare_url":"https://api.github.com/repos/clare/cacophony-processing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clare/cacophony-processing/merges","archive_url":"https://api.github.com/repos/clare/cacophony-processing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clare/cacophony-processing/downloads","issues_url":"https://api.github.com/repos/clare/cacophony-processing/issues{/number}","pulls_url":"https://api.github.com/repos/clare/cacophony-processing/pulls{/number}","milestones_url":"https://api.github.com/repos/clare/cacophony-processing/milestones{/number}","notifications_url":"https://api.github.com/repos/clare/cacophony-processing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clare/cacophony-processing/labels{/name}","releases_url":"https://api.github.com/repos/clare/cacophony-processing/releases{/id}","deployments_url":"https://api.github.com/repos/clare/cacophony-processing/deployments","created_at":"2018-11-14T22:29:43Z","updated_at":"2018-11-14T22:29:45Z","pushed_at":"2018-12-10T03:18:41Z","git_url":"git://github.com/clare/cacophony-processing.git","ssh_url":"git@github.com:clare/cacophony-processing.git","clone_url":"https://github.com/clare/cacophony-processing.git","svn_url":"https://github.com/clare/cacophony-processing","homepage":null,"size":79,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TheCacophonyProject:master","ref":"master","sha":"36828885e9e0a79c5cc26e2fe76a4987d8c2948f","user":{"login":"TheCacophonyProject","id":9919710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk3MTA=","avatar_url":"https://avatars3.githubusercontent.com/u/9919710?v=4","gravatar_id":"","url":"https://api.github.com/users/TheCacophonyProject","html_url":"https://github.com/TheCacophonyProject","followers_url":"https://api.github.com/users/TheCacophonyProject/followers","following_url":"https://api.github.com/users/TheCacophonyProject/following{/other_user}","gists_url":"https://api.github.com/users/TheCacophonyProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheCacophonyProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheCacophonyProject/subscriptions","organizations_url":"https://api.github.com/users/TheCacophonyProject/orgs","repos_url":"https://api.github.com/users/TheCacophonyProject/repos","events_url":"https://api.github.com/users/TheCacophonyProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheCacophonyProject/received_events","type":"Organization","site_admin":false},"repo":{"id":105212165,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUyMTIxNjU=","name":"cacophony-processing","full_name":"TheCacophonyProject/cacophony-processing","private":false,"owner":{"login":"TheCacophonyProject","id":9919710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk3MTA=","avatar_url":"https://avatars3.githubusercontent.com/u/9919710?v=4","gravatar_id":"","url":"https://api.github.com/users/TheCacophonyProject","html_url":"https://github.com/TheCacophonyProject","followers_url":"https://api.github.com/users/TheCacophonyProject/followers","following_url":"https://api.github.com/users/TheCacophonyProject/following{/other_user}","gists_url":"https://api.github.com/users/TheCacophonyProject/gists{/gist_id}","starred_url":"https://api.github.com/users/TheCacophonyProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheCacophonyProject/subscriptions","organizations_url":"https://api.github.com/users/TheCacophonyProject/orgs","repos_url":"https://api.github.com/users/TheCacophonyProject/repos","events_url":"https://api.github.com/users/TheCacophonyProject/events{/privacy}","received_events_url":"https://api.github.com/users/TheCacophonyProject/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/TheCacophonyProject/cacophony-processing","description":null,"fork":false,"url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing","forks_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/forks","keys_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/teams","hooks_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/hooks","issue_events_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/events{/number}","events_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/events","assignees_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/assignees{/user}","branches_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/branches{/branch}","tags_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/tags","blobs_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/statuses/{sha}","languages_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/languages","stargazers_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/stargazers","contributors_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/contributors","subscribers_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/subscribers","subscription_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/subscription","commits_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/contents/{+path}","compare_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/merges","archive_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/downloads","issues_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues{/number}","pulls_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls{/number}","milestones_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/milestones{/number}","notifications_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/labels{/name}","releases_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/releases{/id}","deployments_url":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/deployments","created_at":"2017-09-29T00:32:42Z","updated_at":"2018-12-10T00:35:17Z","pushed_at":"2018-12-10T03:22:09Z","git_url":"git://github.com/TheCacophonyProject/cacophony-processing.git","ssh_url":"git@github.com:TheCacophonyProject/cacophony-processing.git","clone_url":"https://github.com/TheCacophonyProject/cacophony-processing.git","svn_url":"https://github.com/TheCacophonyProject/cacophony-processing","homepage":null,"size":77,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":4,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34"},"html":{"href":"https://github.com/TheCacophonyProject/cacophony-processing/pull/34"},"issue":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/34"},"comments":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/TheCacophonyProject/cacophony-processing/statuses/6317ae33945a22ba96474e0b54bdc35d9759e2ec"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mjs"}}