{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/comments/23280845","id":23280845,"diff_hunk":"@@ -64,4 +67,33 @@ class LookupPointOfInterest(HStoreModel):\n     search = hstore.DictionaryField()\n     response = hstore.DictionaryField()\n     location = djangomodels.ForeignKey(\n-        LookupLocation, related_name='lookup_location')\n+        LookupLocation, related_name='lookup_location',\n+        blank=True, null=True)\n+\n+\n+class LBSRequest(HStoreModel):\n+\n+    \"\"\"\n+    Inbound request for LBS lookup. Triggers LBS API call.\n+    \"\"\"\n+    created_at = djangomodels.DateTimeField(auto_now_add=True)\n+    updated_at = djangomodels.DateTimeField(auto_now=True)\n+    search = hstore.DictionaryField()\n+    response = hstore.DictionaryField(blank=True, null=True)\n+    pointofinterest = djangomodels.ForeignKey(\n+        LookupPointOfInterest, related_name='pointofinterest')\n+\n+\n+# Make sure new LBS Requests tasks are run via Celery\n+@receiver(post_save, sender=LBSRequest)\n+def fire_lbs_task_if_new(sender, instance, created, **kwargs):\n+    if created:\n+        lbs_lookup.delay(instance.id)\n+\n+\n+@receiver(post_save, sender=LookupPointOfInterest)\n+def fire_location_finder_task_if_complete(sender, instance, created, **kwargs):\n+    # Lookup locaction in place and results not in place already\n+    if instance.location != None and \"results\" not in instance.response:\n+        # find match and prepare response\n+        location_finder.delay(instance.id)","path":"django_usaid_clinicfinder/clinicfinder/models.py","position":47,"original_position":44,"commit_id":"f64ce870a6e86d31e6bb5e5febdfd627b873f059","original_commit_id":"01d9c50e7f6e58fe40498f5e81bd0ad9189c4ba8","user":{"login":"imsickofmaps","id":1228977,"avatar_url":"https://avatars.githubusercontent.com/u/1228977?v=3","gravatar_id":"","url":"https://api.github.com/users/imsickofmaps","html_url":"https://github.com/imsickofmaps","followers_url":"https://api.github.com/users/imsickofmaps/followers","following_url":"https://api.github.com/users/imsickofmaps/following{/other_user}","gists_url":"https://api.github.com/users/imsickofmaps/gists{/gist_id}","starred_url":"https://api.github.com/users/imsickofmaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsickofmaps/subscriptions","organizations_url":"https://api.github.com/users/imsickofmaps/orgs","repos_url":"https://api.github.com/users/imsickofmaps/repos","events_url":"https://api.github.com/users/imsickofmaps/events{/privacy}","received_events_url":"https://api.github.com/users/imsickofmaps/received_events","type":"User","site_admin":false},"body":"The reason I've done that is because there's two possible flows to sending the SMS, one immediately triggered and one only if they get a location response. Some will never send.\r\n\r\nI don't see the value in changing this personally. ","created_at":"2015-01-21T06:43:44Z","updated_at":"2015-01-21T06:43:44Z","html_url":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2#discussion_r23280845","pull_request_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/comments/23280845"},"html":{"href":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2#discussion_r23280845"},"pull_request":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2","id":27629580,"html_url":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2","diff_url":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2.diff","patch_url":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2.patch","issue_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/2","number":2,"state":"open","locked":false,"title":"Add LBS support ","user":{"login":"imsickofmaps","id":1228977,"avatar_url":"https://avatars.githubusercontent.com/u/1228977?v=3","gravatar_id":"","url":"https://api.github.com/users/imsickofmaps","html_url":"https://github.com/imsickofmaps","followers_url":"https://api.github.com/users/imsickofmaps/followers","following_url":"https://api.github.com/users/imsickofmaps/following{/other_user}","gists_url":"https://api.github.com/users/imsickofmaps/gists{/gist_id}","starred_url":"https://api.github.com/users/imsickofmaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsickofmaps/subscriptions","organizations_url":"https://api.github.com/users/imsickofmaps/orgs","repos_url":"https://api.github.com/users/imsickofmaps/repos","events_url":"https://api.github.com/users/imsickofmaps/events{/privacy}","received_events_url":"https://api.github.com/users/imsickofmaps/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-19T19:21:02Z","updated_at":"2015-01-21T06:43:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73ffe610a9eec8f4e167530bb57902c3894c1011","assignee":{"login":"imsickofmaps","id":1228977,"avatar_url":"https://avatars.githubusercontent.com/u/1228977?v=3","gravatar_id":"","url":"https://api.github.com/users/imsickofmaps","html_url":"https://github.com/imsickofmaps","followers_url":"https://api.github.com/users/imsickofmaps/followers","following_url":"https://api.github.com/users/imsickofmaps/following{/other_user}","gists_url":"https://api.github.com/users/imsickofmaps/gists{/gist_id}","starred_url":"https://api.github.com/users/imsickofmaps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imsickofmaps/subscriptions","organizations_url":"https://api.github.com/users/imsickofmaps/orgs","repos_url":"https://api.github.com/users/imsickofmaps/repos","events_url":"https://api.github.com/users/imsickofmaps/events{/privacy}","received_events_url":"https://api.github.com/users/imsickofmaps/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2/commits","review_comments_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2/comments","review_comment_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/comments/{number}","comments_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/2/comments","statuses_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/statuses/f64ce870a6e86d31e6bb5e5febdfd627b873f059","head":{"label":"praekelt:feature/issue-2-add-LBS-support","ref":"feature/issue-2-add-LBS-support","sha":"f64ce870a6e86d31e6bb5e5febdfd627b873f059","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":27391116,"name":"django-usaid-clinicfinder","full_name":"praekelt/django-usaid-clinicfinder","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/django-usaid-clinicfinder","description":"","fork":false,"url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder","forks_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/forks","keys_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/teams","hooks_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/hooks","issue_events_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/events","assignees_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/tags","blobs_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/languages","stargazers_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/stargazers","contributors_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/contributors","subscribers_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/subscribers","subscription_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/subscription","commits_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/comments/{number}","contents_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/merges","archive_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/downloads","issues_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/releases{/id}","created_at":"2014-12-01T17:33:22Z","updated_at":"2015-01-20T13:52:56Z","pushed_at":"2015-01-20T17:25:46Z","git_url":"git://github.com/praekelt/django-usaid-clinicfinder.git","ssh_url":"git@github.com:praekelt/django-usaid-clinicfinder.git","clone_url":"https://github.com/praekelt/django-usaid-clinicfinder.git","svn_url":"https://github.com/praekelt/django-usaid-clinicfinder","homepage":null,"size":180,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"860f29f4eedc8a13425b5a6e3eb87dcaa1e210ed","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":27391116,"name":"django-usaid-clinicfinder","full_name":"praekelt/django-usaid-clinicfinder","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/django-usaid-clinicfinder","description":"","fork":false,"url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder","forks_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/forks","keys_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/teams","hooks_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/hooks","issue_events_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/events","assignees_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/tags","blobs_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/languages","stargazers_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/stargazers","contributors_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/contributors","subscribers_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/subscribers","subscription_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/subscription","commits_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/comments/{number}","contents_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/merges","archive_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/downloads","issues_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/releases{/id}","created_at":"2014-12-01T17:33:22Z","updated_at":"2015-01-20T13:52:56Z","pushed_at":"2015-01-20T17:25:46Z","git_url":"git://github.com/praekelt/django-usaid-clinicfinder.git","ssh_url":"git@github.com:praekelt/django-usaid-clinicfinder.git","clone_url":"https://github.com/praekelt/django-usaid-clinicfinder.git","svn_url":"https://github.com/praekelt/django-usaid-clinicfinder","homepage":null,"size":180,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2"},"html":{"href":"https://github.com/praekelt/django-usaid-clinicfinder/pull/2"},"issue":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/2"},"comments":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/django-usaid-clinicfinder/statuses/f64ce870a6e86d31e6bb5e5febdfd627b873f059"}}}}