{"action":"created","comment":{"url":"https://api.github.com/repos/ihmeuw/cascade/pulls/comments/211051698","pull_request_review_id":147396207,"id":211051698,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTA1MTY5OA==","diff_hunk":"@@ -158,95 +169,57 @@ def age_year_from_data(df):\n         values.sort()\n         results[topic] = pd.DataFrame({topic: values})\n         LOGGER.debug(f\"{topic}: {values}\")\n-    return results[\"age\"], results[\"year\"]\n-\n-\n-def integrand_outputs(rates, location_id, age, time):\n-    \"\"\"\n-    The internal model declares what outputs it wants.\n-    \"\"\"\n-    age_time = np.array(list(it.product(age[\"age\"].values, time[\"year\"].values)), dtype=np.float)\n-    entries = list()\n-    for rate in (RATE_TO_INTEGRAND.get(r) for r in rates):\n-        entries.append(pd.DataFrame({\n-            \"integrand\": rate,\n-            \"location_id\": location_id,  # Uses location_id, not node id\n-            \"weight\": \"constant\",  # Assumes a constant rate exists.\n-            # Uses modeler versions of age and year, not age and time.\n-            \"age_start\": age_time[:, 0],\n-            \"age_end\": age_time[:, 0],\n-            \"year_start\": age_time[:, 1],\n-            \"year_end\": age_time[:, 1]\n-        }))\n-    return pd.concat(entries, ignore_index=True)\n-\n-\n-def build_smoothing_grid(age, time):\n-    \"\"\"Builds a default smoothing grid with uniform priors.\"\"\"\n-    age_time = np.array(list(it.product(age[\"age\"].values, time[\"year\"].values)), dtype=np.float)\n-    return pd.DataFrame({\n-        \"age\": age_time[:, 0],\n-        \"year\": age_time[:, 1],\n-        \"value_prior\": \"uniform01\",\n-        \"age_difference_prior\": \"uniform\",\n-        \"time_difference_prior\": \"uniform\",\n-        \"const_value\": np.NaN,\n-    })\n+    return AgeTimeGrid(results[\"age\"].age, results[\"year\"].year)\n \n \n def build_constraint(constraint):\n     \"\"\"\n     This makes a smoothing grid where the mean value is set to a given\n     set of values.\n     \"\"\"\n-    return pd.DataFrame({\n-        \"age\": constraint[\"age_start\"],\n-        \"year\": constraint[\"year_start\"],\n-        \"value_prior\": None,\n-        \"age_difference_prior\": \"uniform\",\n-        \"time_difference_prior\": \"uniform\",\n-        \"const_value\": constraint[\"mean\"],\n-    })\n-\n-\n-def internal_model(model_context, inputs):\n-    config = model_context.parameters\n-    model = model_context.input_data\n+    ages = constraint[\"age_start\"].unique().tolist()\n+    times = constraint[\"year_start\"].unique().tolist()\n+    grid = AgeTimeGrid(ages, times)\n+    smoothing_prior = PriorGrid(grid)\n+    smoothing_prior[:, :].prior = UniformPrior(-np.inf, np.inf, 0)\n+\n+    value_prior = PriorGrid(grid)\n+    # TODO: change the PriorGrid API to handle this elegantly\n+    for _, row in constraint.iterrows():\n+        value_prior[row[\"age_start\"], row[\"year_start\"]].prior = ConstantPrior(row[\"mean\"])","path":"src/cascade/executor/no_covariate_main.py","position":188,"original_position":188,"commit_id":"a54401453cbc346f53426da3d2f8ed88c5defc03","original_commit_id":"a54401453cbc346f53426da3d2f8ed88c5defc03","user":{"login":"adolgert","id":760985,"node_id":"MDQ6VXNlcjc2MDk4NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/760985?v=4","gravatar_id":"","url":"https://api.github.com/users/adolgert","html_url":"https://github.com/adolgert","followers_url":"https://api.github.com/users/adolgert/followers","following_url":"https://api.github.com/users/adolgert/following{/other_user}","gists_url":"https://api.github.com/users/adolgert/gists{/gist_id}","starred_url":"https://api.github.com/users/adolgert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adolgert/subscriptions","organizations_url":"https://api.github.com/users/adolgert/orgs","repos_url":"https://api.github.com/users/adolgert/repos","events_url":"https://api.github.com/users/adolgert/events{/privacy}","received_events_url":"https://api.github.com/users/adolgert/received_events","type":"User","site_admin":false},"body":"Well, I like that it's clearly a constant prior.","created_at":"2018-08-17T23:14:21Z","updated_at":"2018-08-17T23:41:15Z","html_url":"https://github.com/ihmeuw/cascade/pull/25#discussion_r211051698","pull_request_url":"https://api.github.com/repos/ihmeuw/cascade/pulls/25","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/comments/211051698"},"html":{"href":"https://github.com/ihmeuw/cascade/pull/25#discussion_r211051698"},"pull_request":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/ihmeuw/cascade/pulls/25","id":209269226,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MjY5MjI2","html_url":"https://github.com/ihmeuw/cascade/pull/25","diff_url":"https://github.com/ihmeuw/cascade/pull/25.diff","patch_url":"https://github.com/ihmeuw/cascade/pull/25.patch","issue_url":"https://api.github.com/repos/ihmeuw/cascade/issues/25","number":25,"state":"open","locked":false,"title":"Backend for smoothing API and other internal model -> dismodfile translation","user":{"login":"alec-deason","id":419770,"node_id":"MDQ6VXNlcjQxOTc3MA==","avatar_url":"https://avatars3.githubusercontent.com/u/419770?v=4","gravatar_id":"","url":"https://api.github.com/users/alec-deason","html_url":"https://github.com/alec-deason","followers_url":"https://api.github.com/users/alec-deason/followers","following_url":"https://api.github.com/users/alec-deason/following{/other_user}","gists_url":"https://api.github.com/users/alec-deason/gists{/gist_id}","starred_url":"https://api.github.com/users/alec-deason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alec-deason/subscriptions","organizations_url":"https://api.github.com/users/alec-deason/orgs","repos_url":"https://api.github.com/users/alec-deason/repos","events_url":"https://api.github.com/users/alec-deason/events{/privacy}","received_events_url":"https://api.github.com/users/alec-deason/received_events","type":"User","site_admin":false},"body":"This adds a backend for the API in https://github.com/ihmeuw/cascade/pull/15 and integrates it with a lightly cleaned up version of Drew's Dismodfile builder. There is a lot of work to be done on making that part of the system clear and robust, but this starts it.","created_at":"2018-08-17T22:12:57Z","updated_at":"2018-08-17T23:41:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce49ea551e224e5c035bcb4fdd160c943fdc281f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ihmeuw/cascade/pulls/25/commits","review_comments_url":"https://api.github.com/repos/ihmeuw/cascade/pulls/25/comments","review_comment_url":"https://api.github.com/repos/ihmeuw/cascade/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ihmeuw/cascade/issues/25/comments","statuses_url":"https://api.github.com/repos/ihmeuw/cascade/statuses/a54401453cbc346f53426da3d2f8ed88c5defc03","head":{"label":"alec-deason:feature/DISMODAT-267-smoothers-to-dismodfile","ref":"feature/DISMODAT-267-smoothers-to-dismodfile","sha":"a54401453cbc346f53426da3d2f8ed88c5defc03","user":{"login":"alec-deason","id":419770,"node_id":"MDQ6VXNlcjQxOTc3MA==","avatar_url":"https://avatars3.githubusercontent.com/u/419770?v=4","gravatar_id":"","url":"https://api.github.com/users/alec-deason","html_url":"https://github.com/alec-deason","followers_url":"https://api.github.com/users/alec-deason/followers","following_url":"https://api.github.com/users/alec-deason/following{/other_user}","gists_url":"https://api.github.com/users/alec-deason/gists{/gist_id}","starred_url":"https://api.github.com/users/alec-deason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alec-deason/subscriptions","organizations_url":"https://api.github.com/users/alec-deason/orgs","repos_url":"https://api.github.com/users/alec-deason/repos","events_url":"https://api.github.com/users/alec-deason/events{/privacy}","received_events_url":"https://api.github.com/users/alec-deason/received_events","type":"User","site_admin":false},"repo":{"id":141180882,"node_id":"MDEwOlJlcG9zaXRvcnkxNDExODA4ODI=","name":"cascade","full_name":"alec-deason/cascade","owner":{"login":"alec-deason","id":419770,"node_id":"MDQ6VXNlcjQxOTc3MA==","avatar_url":"https://avatars3.githubusercontent.com/u/419770?v=4","gravatar_id":"","url":"https://api.github.com/users/alec-deason","html_url":"https://github.com/alec-deason","followers_url":"https://api.github.com/users/alec-deason/followers","following_url":"https://api.github.com/users/alec-deason/following{/other_user}","gists_url":"https://api.github.com/users/alec-deason/gists{/gist_id}","starred_url":"https://api.github.com/users/alec-deason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alec-deason/subscriptions","organizations_url":"https://api.github.com/users/alec-deason/orgs","repos_url":"https://api.github.com/users/alec-deason/repos","events_url":"https://api.github.com/users/alec-deason/events{/privacy}","received_events_url":"https://api.github.com/users/alec-deason/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alec-deason/cascade","description":"Multi-stage hierarchical estimation of disease processes on demographic observations","fork":true,"url":"https://api.github.com/repos/alec-deason/cascade","forks_url":"https://api.github.com/repos/alec-deason/cascade/forks","keys_url":"https://api.github.com/repos/alec-deason/cascade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alec-deason/cascade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alec-deason/cascade/teams","hooks_url":"https://api.github.com/repos/alec-deason/cascade/hooks","issue_events_url":"https://api.github.com/repos/alec-deason/cascade/issues/events{/number}","events_url":"https://api.github.com/repos/alec-deason/cascade/events","assignees_url":"https://api.github.com/repos/alec-deason/cascade/assignees{/user}","branches_url":"https://api.github.com/repos/alec-deason/cascade/branches{/branch}","tags_url":"https://api.github.com/repos/alec-deason/cascade/tags","blobs_url":"https://api.github.com/repos/alec-deason/cascade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alec-deason/cascade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alec-deason/cascade/git/refs{/sha}","trees_url":"https://api.github.com/repos/alec-deason/cascade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alec-deason/cascade/statuses/{sha}","languages_url":"https://api.github.com/repos/alec-deason/cascade/languages","stargazers_url":"https://api.github.com/repos/alec-deason/cascade/stargazers","contributors_url":"https://api.github.com/repos/alec-deason/cascade/contributors","subscribers_url":"https://api.github.com/repos/alec-deason/cascade/subscribers","subscription_url":"https://api.github.com/repos/alec-deason/cascade/subscription","commits_url":"https://api.github.com/repos/alec-deason/cascade/commits{/sha}","git_commits_url":"https://api.github.com/repos/alec-deason/cascade/git/commits{/sha}","comments_url":"https://api.github.com/repos/alec-deason/cascade/comments{/number}","issue_comment_url":"https://api.github.com/repos/alec-deason/cascade/issues/comments{/number}","contents_url":"https://api.github.com/repos/alec-deason/cascade/contents/{+path}","compare_url":"https://api.github.com/repos/alec-deason/cascade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alec-deason/cascade/merges","archive_url":"https://api.github.com/repos/alec-deason/cascade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alec-deason/cascade/downloads","issues_url":"https://api.github.com/repos/alec-deason/cascade/issues{/number}","pulls_url":"https://api.github.com/repos/alec-deason/cascade/pulls{/number}","milestones_url":"https://api.github.com/repos/alec-deason/cascade/milestones{/number}","notifications_url":"https://api.github.com/repos/alec-deason/cascade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alec-deason/cascade/labels{/name}","releases_url":"https://api.github.com/repos/alec-deason/cascade/releases{/id}","deployments_url":"https://api.github.com/repos/alec-deason/cascade/deployments","created_at":"2018-07-16T18:56:40Z","updated_at":"2018-07-16T18:56:42Z","pushed_at":"2018-08-17T22:09:25Z","git_url":"git://github.com/alec-deason/cascade.git","ssh_url":"git@github.com:alec-deason/cascade.git","clone_url":"https://github.com/alec-deason/cascade.git","svn_url":"https://github.com/alec-deason/cascade","homepage":null,"size":269,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"ihmeuw:develop","ref":"develop","sha":"eb81dc7d1533ab1048009266ff1e0c76ff437706","user":{"login":"ihmeuw","id":4683173,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2ODMxNzM=","avatar_url":"https://avatars1.githubusercontent.com/u/4683173?v=4","gravatar_id":"","url":"https://api.github.com/users/ihmeuw","html_url":"https://github.com/ihmeuw","followers_url":"https://api.github.com/users/ihmeuw/followers","following_url":"https://api.github.com/users/ihmeuw/following{/other_user}","gists_url":"https://api.github.com/users/ihmeuw/gists{/gist_id}","starred_url":"https://api.github.com/users/ihmeuw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihmeuw/subscriptions","organizations_url":"https://api.github.com/users/ihmeuw/orgs","repos_url":"https://api.github.com/users/ihmeuw/repos","events_url":"https://api.github.com/users/ihmeuw/events{/privacy}","received_events_url":"https://api.github.com/users/ihmeuw/received_events","type":"Organization","site_admin":false},"repo":{"id":140491515,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA0OTE1MTU=","name":"cascade","full_name":"ihmeuw/cascade","owner":{"login":"ihmeuw","id":4683173,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2ODMxNzM=","avatar_url":"https://avatars1.githubusercontent.com/u/4683173?v=4","gravatar_id":"","url":"https://api.github.com/users/ihmeuw","html_url":"https://github.com/ihmeuw","followers_url":"https://api.github.com/users/ihmeuw/followers","following_url":"https://api.github.com/users/ihmeuw/following{/other_user}","gists_url":"https://api.github.com/users/ihmeuw/gists{/gist_id}","starred_url":"https://api.github.com/users/ihmeuw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihmeuw/subscriptions","organizations_url":"https://api.github.com/users/ihmeuw/orgs","repos_url":"https://api.github.com/users/ihmeuw/repos","events_url":"https://api.github.com/users/ihmeuw/events{/privacy}","received_events_url":"https://api.github.com/users/ihmeuw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ihmeuw/cascade","description":"Multi-stage hierarchical estimation of disease processes on demographic observations","fork":false,"url":"https://api.github.com/repos/ihmeuw/cascade","forks_url":"https://api.github.com/repos/ihmeuw/cascade/forks","keys_url":"https://api.github.com/repos/ihmeuw/cascade/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ihmeuw/cascade/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ihmeuw/cascade/teams","hooks_url":"https://api.github.com/repos/ihmeuw/cascade/hooks","issue_events_url":"https://api.github.com/repos/ihmeuw/cascade/issues/events{/number}","events_url":"https://api.github.com/repos/ihmeuw/cascade/events","assignees_url":"https://api.github.com/repos/ihmeuw/cascade/assignees{/user}","branches_url":"https://api.github.com/repos/ihmeuw/cascade/branches{/branch}","tags_url":"https://api.github.com/repos/ihmeuw/cascade/tags","blobs_url":"https://api.github.com/repos/ihmeuw/cascade/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ihmeuw/cascade/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ihmeuw/cascade/git/refs{/sha}","trees_url":"https://api.github.com/repos/ihmeuw/cascade/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ihmeuw/cascade/statuses/{sha}","languages_url":"https://api.github.com/repos/ihmeuw/cascade/languages","stargazers_url":"https://api.github.com/repos/ihmeuw/cascade/stargazers","contributors_url":"https://api.github.com/repos/ihmeuw/cascade/contributors","subscribers_url":"https://api.github.com/repos/ihmeuw/cascade/subscribers","subscription_url":"https://api.github.com/repos/ihmeuw/cascade/subscription","commits_url":"https://api.github.com/repos/ihmeuw/cascade/commits{/sha}","git_commits_url":"https://api.github.com/repos/ihmeuw/cascade/git/commits{/sha}","comments_url":"https://api.github.com/repos/ihmeuw/cascade/comments{/number}","issue_comment_url":"https://api.github.com/repos/ihmeuw/cascade/issues/comments{/number}","contents_url":"https://api.github.com/repos/ihmeuw/cascade/contents/{+path}","compare_url":"https://api.github.com/repos/ihmeuw/cascade/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ihmeuw/cascade/merges","archive_url":"https://api.github.com/repos/ihmeuw/cascade/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ihmeuw/cascade/downloads","issues_url":"https://api.github.com/repos/ihmeuw/cascade/issues{/number}","pulls_url":"https://api.github.com/repos/ihmeuw/cascade/pulls{/number}","milestones_url":"https://api.github.com/repos/ihmeuw/cascade/milestones{/number}","notifications_url":"https://api.github.com/repos/ihmeuw/cascade/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ihmeuw/cascade/labels{/name}","releases_url":"https://api.github.com/repos/ihmeuw/cascade/releases{/id}","deployments_url":"https://api.github.com/repos/ihmeuw/cascade/deployments","created_at":"2018-07-10T22:01:19Z","updated_at":"2018-08-17T16:06:17Z","pushed_at":"2018-08-17T23:13:00Z","git_url":"git://github.com/ihmeuw/cascade.git","ssh_url":"git@github.com:ihmeuw/cascade.git","clone_url":"https://github.com/ihmeuw/cascade.git","svn_url":"https://github.com/ihmeuw/cascade","homepage":"https://cascade.readthedocs.io/en/latest/","size":216,"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":4,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":4,"open_issues":4,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/25"},"html":{"href":"https://github.com/ihmeuw/cascade/pull/25"},"issue":{"href":"https://api.github.com/repos/ihmeuw/cascade/issues/25"},"comments":{"href":"https://api.github.com/repos/ihmeuw/cascade/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ihmeuw/cascade/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/ihmeuw/cascade/statuses/a54401453cbc346f53426da3d2f8ed88c5defc03"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"adolgert"}}