{"action":"created","comment":{"url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/comments/201425396","pull_request_review_id":135910884,"id":201425396,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMTQyNTM5Ng==","diff_hunk":"@@ -103,28 +94,23 @@ def rp_event(request):\n     # Takes in the information from Rapid Pro\n     status_code = 405\n     if request.method == \"POST\":\n-        status_code = 400\n         if request.GET.get('secret') == \"momkhulu\":\n-            patient = PatientSerializer(data=get_patient_dict(request.body))\n-            patiententry = PatientEntrySerializer(\n-                data=get_patiententry_dict(request.body)\n-            )\n-            if patient.is_valid():\n-                patient.save()\n-            if patiententry.is_valid():\n-                patiententry.save()\n-                status_code = 201\n+            status_code = save_model(request.POST)\n+            if status_code == 201:\n                 send_consumers_table()\n     return HttpResponse(status=status_code)\n \n \n @csrf_exempt\n def patientexists(request):\n+    \"\"\"\n+        Returns 200 if Patient exists and 400 if Patient Does Not Exist\n+    \"\"\"\n     status_code = 405\n     if request.method == \"POST\":\n         try:\n             Patient.objects.get(","path":"cspatients/views.py","position":71,"original_position":71,"commit_id":"775b750ed4a066d83bb1c682f4cabdf705b1297e","original_commit_id":"775b750ed4a066d83bb1c682f4cabdf705b1297e","user":{"login":"KaitCrawford","id":1230707,"node_id":"MDQ6VXNlcjEyMzA3MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/1230707?v=4","gravatar_id":"","url":"https://api.github.com/users/KaitCrawford","html_url":"https://github.com/KaitCrawford","followers_url":"https://api.github.com/users/KaitCrawford/followers","following_url":"https://api.github.com/users/KaitCrawford/following{/other_user}","gists_url":"https://api.github.com/users/KaitCrawford/gists{/gist_id}","starred_url":"https://api.github.com/users/KaitCrawford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KaitCrawford/subscriptions","organizations_url":"https://api.github.com/users/KaitCrawford/orgs","repos_url":"https://api.github.com/users/KaitCrawford/repos","events_url":"https://api.github.com/users/KaitCrawford/events{/privacy}","received_events_url":"https://api.github.com/users/KaitCrawford/received_events","type":"User","site_admin":false},"body":"Take a look at https://docs.djangoproject.com/en/2.0/topics/http/shortcuts/#get-object-or-404\r\nThat method might help you remove some of the overhead you're doing in some places","created_at":"2018-07-10T17:16:50Z","updated_at":"2018-07-10T17:18:13Z","html_url":"https://github.com/praekeltfoundation/momkhulu/pull/6#discussion_r201425396","pull_request_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/comments/201425396"},"html":{"href":"https://github.com/praekeltfoundation/momkhulu/pull/6#discussion_r201425396"},"pull_request":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6","id":200427880,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAwNDI3ODgw","html_url":"https://github.com/praekeltfoundation/momkhulu/pull/6","diff_url":"https://github.com/praekeltfoundation/momkhulu/pull/6.diff","patch_url":"https://github.com/praekeltfoundation/momkhulu/pull/6.patch","issue_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/6","number":6,"state":"open","locked":false,"title":"Application API endpoint views and methods","user":{"login":"nyashabryan","id":19518198,"node_id":"MDQ6VXNlcjE5NTE4MTk4","avatar_url":"https://avatars1.githubusercontent.com/u/19518198?v=4","gravatar_id":"","url":"https://api.github.com/users/nyashabryan","html_url":"https://github.com/nyashabryan","followers_url":"https://api.github.com/users/nyashabryan/followers","following_url":"https://api.github.com/users/nyashabryan/following{/other_user}","gists_url":"https://api.github.com/users/nyashabryan/gists{/gist_id}","starred_url":"https://api.github.com/users/nyashabryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyashabryan/subscriptions","organizations_url":"https://api.github.com/users/nyashabryan/orgs","repos_url":"https://api.github.com/users/nyashabryan/repos","events_url":"https://api.github.com/users/nyashabryan/events{/privacy}","received_events_url":"https://api.github.com/users/nyashabryan/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-10T15:02:49Z","updated_at":"2018-07-10T17:18:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18870d6b6f0304f63efc646d2b40f9968abec440","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6/commits","review_comments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6/comments","review_comment_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/6/comments","statuses_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/statuses/775b750ed4a066d83bb1c682f4cabdf705b1297e","head":{"label":"praekeltfoundation:app-api","ref":"app-api","sha":"775b750ed4a066d83bb1c682f4cabdf705b1297e","user":{"login":"praekeltfoundation","id":15786759,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1Nzg2NzU5","avatar_url":"https://avatars3.githubusercontent.com/u/15786759?v=4","gravatar_id":"","url":"https://api.github.com/users/praekeltfoundation","html_url":"https://github.com/praekeltfoundation","followers_url":"https://api.github.com/users/praekeltfoundation/followers","following_url":"https://api.github.com/users/praekeltfoundation/following{/other_user}","gists_url":"https://api.github.com/users/praekeltfoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/praekeltfoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekeltfoundation/subscriptions","organizations_url":"https://api.github.com/users/praekeltfoundation/orgs","repos_url":"https://api.github.com/users/praekeltfoundation/repos","events_url":"https://api.github.com/users/praekeltfoundation/events{/privacy}","received_events_url":"https://api.github.com/users/praekeltfoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":137906477,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc5MDY0Nzc=","name":"momkhulu","full_name":"praekeltfoundation/momkhulu","owner":{"login":"praekeltfoundation","id":15786759,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1Nzg2NzU5","avatar_url":"https://avatars3.githubusercontent.com/u/15786759?v=4","gravatar_id":"","url":"https://api.github.com/users/praekeltfoundation","html_url":"https://github.com/praekeltfoundation","followers_url":"https://api.github.com/users/praekeltfoundation/followers","following_url":"https://api.github.com/users/praekeltfoundation/following{/other_user}","gists_url":"https://api.github.com/users/praekeltfoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/praekeltfoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekeltfoundation/subscriptions","organizations_url":"https://api.github.com/users/praekeltfoundation/orgs","repos_url":"https://api.github.com/users/praekeltfoundation/repos","events_url":"https://api.github.com/users/praekeltfoundation/events{/privacy}","received_events_url":"https://api.github.com/users/praekeltfoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekeltfoundation/momkhulu","description":"Hospital resource allocation interface","fork":false,"url":"https://api.github.com/repos/praekeltfoundation/momkhulu","forks_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/forks","keys_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/teams","hooks_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/hooks","issue_events_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/events{/number}","events_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/events","assignees_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/assignees{/user}","branches_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/branches{/branch}","tags_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/tags","blobs_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/statuses/{sha}","languages_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/languages","stargazers_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/stargazers","contributors_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/contributors","subscribers_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/subscribers","subscription_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/subscription","commits_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/contents/{+path}","compare_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/merges","archive_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/downloads","issues_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues{/number}","pulls_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls{/number}","milestones_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/milestones{/number}","notifications_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/labels{/name}","releases_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/releases{/id}","deployments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/deployments","created_at":"2018-06-19T14:55:30Z","updated_at":"2018-07-10T15:52:05Z","pushed_at":"2018-07-10T16:01:46Z","git_url":"git://github.com/praekeltfoundation/momkhulu.git","ssh_url":"git@github.com:praekeltfoundation/momkhulu.git","clone_url":"https://github.com/praekeltfoundation/momkhulu.git","svn_url":"https://github.com/praekeltfoundation/momkhulu","homepage":null,"size":87,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"praekeltfoundation:develop","ref":"develop","sha":"078822aeedd76c58624f80f1033094c78ef974d2","user":{"login":"praekeltfoundation","id":15786759,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1Nzg2NzU5","avatar_url":"https://avatars3.githubusercontent.com/u/15786759?v=4","gravatar_id":"","url":"https://api.github.com/users/praekeltfoundation","html_url":"https://github.com/praekeltfoundation","followers_url":"https://api.github.com/users/praekeltfoundation/followers","following_url":"https://api.github.com/users/praekeltfoundation/following{/other_user}","gists_url":"https://api.github.com/users/praekeltfoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/praekeltfoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekeltfoundation/subscriptions","organizations_url":"https://api.github.com/users/praekeltfoundation/orgs","repos_url":"https://api.github.com/users/praekeltfoundation/repos","events_url":"https://api.github.com/users/praekeltfoundation/events{/privacy}","received_events_url":"https://api.github.com/users/praekeltfoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":137906477,"node_id":"MDEwOlJlcG9zaXRvcnkxMzc5MDY0Nzc=","name":"momkhulu","full_name":"praekeltfoundation/momkhulu","owner":{"login":"praekeltfoundation","id":15786759,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1Nzg2NzU5","avatar_url":"https://avatars3.githubusercontent.com/u/15786759?v=4","gravatar_id":"","url":"https://api.github.com/users/praekeltfoundation","html_url":"https://github.com/praekeltfoundation","followers_url":"https://api.github.com/users/praekeltfoundation/followers","following_url":"https://api.github.com/users/praekeltfoundation/following{/other_user}","gists_url":"https://api.github.com/users/praekeltfoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/praekeltfoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekeltfoundation/subscriptions","organizations_url":"https://api.github.com/users/praekeltfoundation/orgs","repos_url":"https://api.github.com/users/praekeltfoundation/repos","events_url":"https://api.github.com/users/praekeltfoundation/events{/privacy}","received_events_url":"https://api.github.com/users/praekeltfoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekeltfoundation/momkhulu","description":"Hospital resource allocation interface","fork":false,"url":"https://api.github.com/repos/praekeltfoundation/momkhulu","forks_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/forks","keys_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/teams","hooks_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/hooks","issue_events_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/events{/number}","events_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/events","assignees_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/assignees{/user}","branches_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/branches{/branch}","tags_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/tags","blobs_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/statuses/{sha}","languages_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/languages","stargazers_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/stargazers","contributors_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/contributors","subscribers_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/subscribers","subscription_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/subscription","commits_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/contents/{+path}","compare_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/merges","archive_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/downloads","issues_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues{/number}","pulls_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls{/number}","milestones_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/milestones{/number}","notifications_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/labels{/name}","releases_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/releases{/id}","deployments_url":"https://api.github.com/repos/praekeltfoundation/momkhulu/deployments","created_at":"2018-06-19T14:55:30Z","updated_at":"2018-07-10T15:52:05Z","pushed_at":"2018-07-10T16:01:46Z","git_url":"git://github.com/praekeltfoundation/momkhulu.git","ssh_url":"git@github.com:praekeltfoundation/momkhulu.git","clone_url":"https://github.com/praekeltfoundation/momkhulu.git","svn_url":"https://github.com/praekeltfoundation/momkhulu","homepage":null,"size":87,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6"},"html":{"href":"https://github.com/praekeltfoundation/momkhulu/pull/6"},"issue":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/6"},"comments":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/praekeltfoundation/momkhulu/statuses/775b750ed4a066d83bb1c682f4cabdf705b1297e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"KaitCrawford"}}