{"action":"opened","number":30,"pull_request":{"url":"https://api.github.com/repos/synthetichealth/synthea/pulls/30","id":85040078,"html_url":"https://github.com/synthetichealth/synthea/pull/30","diff_url":"https://github.com/synthetichealth/synthea/pull/30.diff","patch_url":"https://github.com/synthetichealth/synthea/pull/30.patch","issue_url":"https://api.github.com/repos/synthetichealth/synthea/issues/30","number":30,"state":"open","locked":false,"title":"Opioids model","user":{"login":"dehall","id":13512036,"avatar_url":"https://avatars.githubusercontent.com/u/13512036?v=3","gravatar_id":"","url":"https://api.github.com/users/dehall","html_url":"https://github.com/dehall","followers_url":"https://api.github.com/users/dehall/followers","following_url":"https://api.github.com/users/dehall/following{/other_user}","gists_url":"https://api.github.com/users/dehall/gists{/gist_id}","starred_url":"https://api.github.com/users/dehall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dehall/subscriptions","organizations_url":"https://api.github.com/users/dehall/orgs","repos_url":"https://api.github.com/users/dehall/repos","events_url":"https://api.github.com/users/dehall/events{/privacy}","received_events_url":"https://api.github.com/users/dehall/received_events","type":"User","site_admin":false},"body":"Creates a generic module for the opioids addiction model developed by [Project SAMMI](http://projectsammi.github.io/)\r\n\r\nAdds the ability for generic modules to have complex transitions, which are a combination of conditional and distributed transitions. \r\n\r\nAdds a \"Socioeconomic Status\" to each person, made up of 3 factors which range from 0.0 to 1.0; education, income, and occupation. SES is assigned at birth, and is based on the town using census data.\r\n\r\nAdds the ability for generic modules to do logic based on SES.\r\n\r\n![opioid addiction](https://cloud.githubusercontent.com/assets/13512036/18473905/4bb83960-798d-11e6-9b3d-2c9a60303cd8.png)\r\n\r\nFor the Wiki:\r\n\r\n## Complex\r\n\r\n`Complex` transitions are a combination of distributed and conditional transitions.  A `complex_transition` consists of an array of `condition`/`distributions` pairs which are tested in the order they are defined.  The first condition that evaluates to `true` will result in a transition based on its corresponding `distributions`.  The module will then transition to one of the transitions defined in `distributions` according to the same rules as the `distributed_transition`. See [Distributed](#distributed) for more detail. The last element in the `complex_transition` array may contain only a `distributions` (with no `condition`) to indicate a fallback transition when all other conditions are `false`.\r\n\r\nIf none of the `conditions` evaluated to `true`, and no fallback transition was specified, the module will transition to a default `Terminal` state.\r\n\r\nPlease see the [Logic](#logic) section for more information about creating logical conditions.\r\n\r\n**Example**\r\n\r\nThe following example demonstrates a state that for male patients should transition to the \"Foo\" state with 15% probability and the \"Bar\" state with 85% probability, and for female patients should transition to the \"Baz\" state with 75% probability and the \"Qux\" state with 25% probability.\r\n\r\n```json\r\n{\r\n    \"type\": \"Initial\",\r\n    \"complex_transition\": [\r\n        {\r\n            \"condition\": {\r\n                \"condition_type\": \"Gender\",\r\n                \"gender\": \"M\" \r\n            },\r\n            \"distributions\" : [\r\n                {\r\n                    \"distribution\": 0.15,\r\n                    \"transition\": \"Foo\"\r\n                },\r\n                {\r\n                    \"distribution\": 0.85,\r\n                    \"transition\": \"Bar\"\r\n                }\r\n            ]\r\n        },\r\n        {\r\n            \"condition\": {\r\n                \"condition_type\": \"Gender\",\r\n                \"gender\": \"F\" \r\n            },\r\n            \"distributions\" : [\r\n                {\r\n                    \"distribution\": 0.75,\r\n                    \"transition\": \"Baz\"\r\n                },\r\n                {\r\n                    \"distribution\": 0.25,\r\n                    \"transition\": \"Qux\"\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n\r\n## Socioeconomic Status\r\n\r\nThe `Socioeconomic Status` condition type tests the patient's socioeconomic status. Socioeconomic status is based on income, education, and occupation, and is categorized in Synthea as \"High\", \"Medium\", or \"Low\".\r\n\r\n**Supported Properties**\r\n\r\n* **condition_type**: must be \"Socioeconomic Status\" _(required)_\r\n* **category**: the gender to test for.  Synthea currently defines the following categories: `High`, `Medium`, or `Low`. _(required)_\r\n\r\n**Example**\r\n\r\nThe following Socioeconomic Status condition will return `true` if the patient is \"Middle\" Socioeconomic Status; `false` otherwise.\r\n\r\n```json\r\n{\r\n  \"condition_type\" : \"Socioeconomic Status\",\r\n  \"category\" : \"Middle\"\r\n}\r\n```\r\n","created_at":"2016-09-13T12:38:25Z","updated_at":"2016-09-13T12:38:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba6962a52fbbb8cc1acba65b669819e7354008b5","assignee":{"login":"jawalonoski","id":1054765,"avatar_url":"https://avatars.githubusercontent.com/u/1054765?v=3","gravatar_id":"","url":"https://api.github.com/users/jawalonoski","html_url":"https://github.com/jawalonoski","followers_url":"https://api.github.com/users/jawalonoski/followers","following_url":"https://api.github.com/users/jawalonoski/following{/other_user}","gists_url":"https://api.github.com/users/jawalonoski/gists{/gist_id}","starred_url":"https://api.github.com/users/jawalonoski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jawalonoski/subscriptions","organizations_url":"https://api.github.com/users/jawalonoski/orgs","repos_url":"https://api.github.com/users/jawalonoski/repos","events_url":"https://api.github.com/users/jawalonoski/events{/privacy}","received_events_url":"https://api.github.com/users/jawalonoski/received_events","type":"User","site_admin":false},"assignees":[{"login":"jawalonoski","id":1054765,"avatar_url":"https://avatars.githubusercontent.com/u/1054765?v=3","gravatar_id":"","url":"https://api.github.com/users/jawalonoski","html_url":"https://github.com/jawalonoski","followers_url":"https://api.github.com/users/jawalonoski/followers","following_url":"https://api.github.com/users/jawalonoski/following{/other_user}","gists_url":"https://api.github.com/users/jawalonoski/gists{/gist_id}","starred_url":"https://api.github.com/users/jawalonoski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jawalonoski/subscriptions","organizations_url":"https://api.github.com/users/jawalonoski/orgs","repos_url":"https://api.github.com/users/jawalonoski/repos","events_url":"https://api.github.com/users/jawalonoski/events{/privacy}","received_events_url":"https://api.github.com/users/jawalonoski/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/synthetichealth/synthea/pulls/30/commits","review_comments_url":"https://api.github.com/repos/synthetichealth/synthea/pulls/30/comments","review_comment_url":"https://api.github.com/repos/synthetichealth/synthea/pulls/comments{/number}","comments_url":"https://api.github.com/repos/synthetichealth/synthea/issues/30/comments","statuses_url":"https://api.github.com/repos/synthetichealth/synthea/statuses/b73b1e191fbc2390225f1b16c901689fc9663979","head":{"label":"synthetichealth:opioids_model","ref":"opioids_model","sha":"b73b1e191fbc2390225f1b16c901689fc9663979","user":{"login":"synthetichealth","id":19552017,"avatar_url":"https://avatars.githubusercontent.com/u/19552017?v=3","gravatar_id":"","url":"https://api.github.com/users/synthetichealth","html_url":"https://github.com/synthetichealth","followers_url":"https://api.github.com/users/synthetichealth/followers","following_url":"https://api.github.com/users/synthetichealth/following{/other_user}","gists_url":"https://api.github.com/users/synthetichealth/gists{/gist_id}","starred_url":"https://api.github.com/users/synthetichealth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synthetichealth/subscriptions","organizations_url":"https://api.github.com/users/synthetichealth/orgs","repos_url":"https://api.github.com/users/synthetichealth/repos","events_url":"https://api.github.com/users/synthetichealth/events{/privacy}","received_events_url":"https://api.github.com/users/synthetichealth/received_events","type":"Organization","site_admin":false},"repo":{"id":61399845,"name":"synthea","full_name":"synthetichealth/synthea","owner":{"login":"synthetichealth","id":19552017,"avatar_url":"https://avatars.githubusercontent.com/u/19552017?v=3","gravatar_id":"","url":"https://api.github.com/users/synthetichealth","html_url":"https://github.com/synthetichealth","followers_url":"https://api.github.com/users/synthetichealth/followers","following_url":"https://api.github.com/users/synthetichealth/following{/other_user}","gists_url":"https://api.github.com/users/synthetichealth/gists{/gist_id}","starred_url":"https://api.github.com/users/synthetichealth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synthetichealth/subscriptions","organizations_url":"https://api.github.com/users/synthetichealth/orgs","repos_url":"https://api.github.com/users/synthetichealth/repos","events_url":"https://api.github.com/users/synthetichealth/events{/privacy}","received_events_url":"https://api.github.com/users/synthetichealth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/synthetichealth/synthea","description":"Synthetic Patient Population Simulator","fork":false,"url":"https://api.github.com/repos/synthetichealth/synthea","forks_url":"https://api.github.com/repos/synthetichealth/synthea/forks","keys_url":"https://api.github.com/repos/synthetichealth/synthea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/synthetichealth/synthea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/synthetichealth/synthea/teams","hooks_url":"https://api.github.com/repos/synthetichealth/synthea/hooks","issue_events_url":"https://api.github.com/repos/synthetichealth/synthea/issues/events{/number}","events_url":"https://api.github.com/repos/synthetichealth/synthea/events","assignees_url":"https://api.github.com/repos/synthetichealth/synthea/assignees{/user}","branches_url":"https://api.github.com/repos/synthetichealth/synthea/branches{/branch}","tags_url":"https://api.github.com/repos/synthetichealth/synthea/tags","blobs_url":"https://api.github.com/repos/synthetichealth/synthea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/synthetichealth/synthea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/synthetichealth/synthea/git/refs{/sha}","trees_url":"https://api.github.com/repos/synthetichealth/synthea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/synthetichealth/synthea/statuses/{sha}","languages_url":"https://api.github.com/repos/synthetichealth/synthea/languages","stargazers_url":"https://api.github.com/repos/synthetichealth/synthea/stargazers","contributors_url":"https://api.github.com/repos/synthetichealth/synthea/contributors","subscribers_url":"https://api.github.com/repos/synthetichealth/synthea/subscribers","subscription_url":"https://api.github.com/repos/synthetichealth/synthea/subscription","commits_url":"https://api.github.com/repos/synthetichealth/synthea/commits{/sha}","git_commits_url":"https://api.github.com/repos/synthetichealth/synthea/git/commits{/sha}","comments_url":"https://api.github.com/repos/synthetichealth/synthea/comments{/number}","issue_comment_url":"https://api.github.com/repos/synthetichealth/synthea/issues/comments{/number}","contents_url":"https://api.github.com/repos/synthetichealth/synthea/contents/{+path}","compare_url":"https://api.github.com/repos/synthetichealth/synthea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/synthetichealth/synthea/merges","archive_url":"https://api.github.com/repos/synthetichealth/synthea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/synthetichealth/synthea/downloads","issues_url":"https://api.github.com/repos/synthetichealth/synthea/issues{/number}","pulls_url":"https://api.github.com/repos/synthetichealth/synthea/pulls{/number}","milestones_url":"https://api.github.com/repos/synthetichealth/synthea/milestones{/number}","notifications_url":"https://api.github.com/repos/synthetichealth/synthea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/synthetichealth/synthea/labels{/name}","releases_url":"https://api.github.com/repos/synthetichealth/synthea/releases{/id}","deployments_url":"https://api.github.com/repos/synthetichealth/synthea/deployments","created_at":"2016-06-17T20:15:40Z","updated_at":"2016-06-17T20:20:39Z","pushed_at":"2016-09-13T12:38:26Z","git_url":"git://github.com/synthetichealth/synthea.git","ssh_url":"git@github.com:synthetichealth/synthea.git","clone_url":"https://github.com/synthetichealth/synthea.git","svn_url":"https://github.com/synthetichealth/synthea","homepage":null,"size":1205,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"synthetichealth:master","ref":"master","sha":"b6fb692b0be581062f13918cf6f36b27e5514b78","user":{"login":"synthetichealth","id":19552017,"avatar_url":"https://avatars.githubusercontent.com/u/19552017?v=3","gravatar_id":"","url":"https://api.github.com/users/synthetichealth","html_url":"https://github.com/synthetichealth","followers_url":"https://api.github.com/users/synthetichealth/followers","following_url":"https://api.github.com/users/synthetichealth/following{/other_user}","gists_url":"https://api.github.com/users/synthetichealth/gists{/gist_id}","starred_url":"https://api.github.com/users/synthetichealth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synthetichealth/subscriptions","organizations_url":"https://api.github.com/users/synthetichealth/orgs","repos_url":"https://api.github.com/users/synthetichealth/repos","events_url":"https://api.github.com/users/synthetichealth/events{/privacy}","received_events_url":"https://api.github.com/users/synthetichealth/received_events","type":"Organization","site_admin":false},"repo":{"id":61399845,"name":"synthea","full_name":"synthetichealth/synthea","owner":{"login":"synthetichealth","id":19552017,"avatar_url":"https://avatars.githubusercontent.com/u/19552017?v=3","gravatar_id":"","url":"https://api.github.com/users/synthetichealth","html_url":"https://github.com/synthetichealth","followers_url":"https://api.github.com/users/synthetichealth/followers","following_url":"https://api.github.com/users/synthetichealth/following{/other_user}","gists_url":"https://api.github.com/users/synthetichealth/gists{/gist_id}","starred_url":"https://api.github.com/users/synthetichealth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synthetichealth/subscriptions","organizations_url":"https://api.github.com/users/synthetichealth/orgs","repos_url":"https://api.github.com/users/synthetichealth/repos","events_url":"https://api.github.com/users/synthetichealth/events{/privacy}","received_events_url":"https://api.github.com/users/synthetichealth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/synthetichealth/synthea","description":"Synthetic Patient Population Simulator","fork":false,"url":"https://api.github.com/repos/synthetichealth/synthea","forks_url":"https://api.github.com/repos/synthetichealth/synthea/forks","keys_url":"https://api.github.com/repos/synthetichealth/synthea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/synthetichealth/synthea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/synthetichealth/synthea/teams","hooks_url":"https://api.github.com/repos/synthetichealth/synthea/hooks","issue_events_url":"https://api.github.com/repos/synthetichealth/synthea/issues/events{/number}","events_url":"https://api.github.com/repos/synthetichealth/synthea/events","assignees_url":"https://api.github.com/repos/synthetichealth/synthea/assignees{/user}","branches_url":"https://api.github.com/repos/synthetichealth/synthea/branches{/branch}","tags_url":"https://api.github.com/repos/synthetichealth/synthea/tags","blobs_url":"https://api.github.com/repos/synthetichealth/synthea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/synthetichealth/synthea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/synthetichealth/synthea/git/refs{/sha}","trees_url":"https://api.github.com/repos/synthetichealth/synthea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/synthetichealth/synthea/statuses/{sha}","languages_url":"https://api.github.com/repos/synthetichealth/synthea/languages","stargazers_url":"https://api.github.com/repos/synthetichealth/synthea/stargazers","contributors_url":"https://api.github.com/repos/synthetichealth/synthea/contributors","subscribers_url":"https://api.github.com/repos/synthetichealth/synthea/subscribers","subscription_url":"https://api.github.com/repos/synthetichealth/synthea/subscription","commits_url":"https://api.github.com/repos/synthetichealth/synthea/commits{/sha}","git_commits_url":"https://api.github.com/repos/synthetichealth/synthea/git/commits{/sha}","comments_url":"https://api.github.com/repos/synthetichealth/synthea/comments{/number}","issue_comment_url":"https://api.github.com/repos/synthetichealth/synthea/issues/comments{/number}","contents_url":"https://api.github.com/repos/synthetichealth/synthea/contents/{+path}","compare_url":"https://api.github.com/repos/synthetichealth/synthea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/synthetichealth/synthea/merges","archive_url":"https://api.github.com/repos/synthetichealth/synthea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/synthetichealth/synthea/downloads","issues_url":"https://api.github.com/repos/synthetichealth/synthea/issues{/number}","pulls_url":"https://api.github.com/repos/synthetichealth/synthea/pulls{/number}","milestones_url":"https://api.github.com/repos/synthetichealth/synthea/milestones{/number}","notifications_url":"https://api.github.com/repos/synthetichealth/synthea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/synthetichealth/synthea/labels{/name}","releases_url":"https://api.github.com/repos/synthetichealth/synthea/releases{/id}","deployments_url":"https://api.github.com/repos/synthetichealth/synthea/deployments","created_at":"2016-06-17T20:15:40Z","updated_at":"2016-06-17T20:20:39Z","pushed_at":"2016-09-13T12:38:26Z","git_url":"git://github.com/synthetichealth/synthea.git","ssh_url":"git@github.com:synthetichealth/synthea.git","clone_url":"https://github.com/synthetichealth/synthea.git","svn_url":"https://github.com/synthetichealth/synthea","homepage":null,"size":1205,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/synthetichealth/synthea/pulls/30"},"html":{"href":"https://github.com/synthetichealth/synthea/pull/30"},"issue":{"href":"https://api.github.com/repos/synthetichealth/synthea/issues/30"},"comments":{"href":"https://api.github.com/repos/synthetichealth/synthea/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/synthetichealth/synthea/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/synthetichealth/synthea/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/synthetichealth/synthea/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/synthetichealth/synthea/statuses/b73b1e191fbc2390225f1b16c901689fc9663979"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":6,"additions":15974,"deletions":27,"changed_files":34}}
{"actor":{"display_login":"dehall"}}