{"action":"created","comment":{"url":"https://api.github.com/repos/gem/oq-risklib/pulls/comments/30699872","id":30699872,"diff_hunk":"@@ -98,4 +252,66 @@ def export_classical_damage_csv(key, export_dir, fname, damage_states,\n         for asset in sorted(fractions_by_asset):\n             writer.writerow(\n                 [asset.id] + map(scientificformat, fractions_by_asset[asset]))\n-    return AccumDict({key: dest})\n+    return dest\n+\n+\n+# exports for scenario_risk\n+\n+AggLoss = collections.namedtuple(\n+    'AggLoss', 'loss_type unit mean stddev')\n+\n+PerAssetLoss = collections.namedtuple(  # the loss map\n+    'PerAssetLoss', 'loss_type unit asset_ref mean stddev')\n+\n+\n+@export.add(('losses_by_key', 'csv'))\n+def export_risk(ekey, dstore):","path":"openquake/commonlib/export/risk.py","position":273,"original_position":273,"commit_id":"4e770b51afd5b31cc74e5ee13e34ed973dd661d4","original_commit_id":"4e770b51afd5b31cc74e5ee13e34ed973dd661d4","user":{"login":"micheles","id":2463856,"avatar_url":"https://avatars.githubusercontent.com/u/2463856?v=3","gravatar_id":"","url":"https://api.github.com/users/micheles","html_url":"https://github.com/micheles","followers_url":"https://api.github.com/users/micheles/followers","following_url":"https://api.github.com/users/micheles/following{/other_user}","gists_url":"https://api.github.com/users/micheles/gists{/gist_id}","starred_url":"https://api.github.com/users/micheles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheles/subscriptions","organizations_url":"https://api.github.com/users/micheles/orgs","repos_url":"https://api.github.com/users/micheles/repos","events_url":"https://api.github.com/users/micheles/events{/privacy}","received_events_url":"https://api.github.com/users/micheles/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2015-05-20T13:19:19Z","updated_at":"2015-05-20T13:19:19Z","html_url":"https://github.com/gem/oq-risklib/pull/243#discussion_r30699872","pull_request_url":"https://api.github.com/repos/gem/oq-risklib/pulls/243","_links":{"self":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/comments/30699872"},"html":{"href":"https://github.com/gem/oq-risklib/pull/243#discussion_r30699872"},"pull_request":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/243"}}},"pull_request":{"url":"https://api.github.com/repos/gem/oq-risklib/pulls/243","id":35291953,"html_url":"https://github.com/gem/oq-risklib/pull/243","diff_url":"https://github.com/gem/oq-risklib/pull/243.diff","patch_url":"https://github.com/gem/oq-risklib/pull/243.patch","issue_url":"https://api.github.com/repos/gem/oq-risklib/issues/243","number":243,"state":"open","locked":false,"title":"Export-on-demand","user":{"login":"micheles","id":2463856,"avatar_url":"https://avatars.githubusercontent.com/u/2463856?v=3","gravatar_id":"","url":"https://api.github.com/users/micheles","html_url":"https://github.com/micheles","followers_url":"https://api.github.com/users/micheles/followers","following_url":"https://api.github.com/users/micheles/following{/other_user}","gists_url":"https://api.github.com/users/micheles/gists{/gist_id}","starred_url":"https://api.github.com/users/micheles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheles/subscriptions","organizations_url":"https://api.github.com/users/micheles/orgs","repos_url":"https://api.github.com/users/micheles/repos","events_url":"https://api.github.com/users/micheles/events{/privacy}","received_events_url":"https://api.github.com/users/micheles/received_events","type":"User","site_admin":false},"body":"Now all outputs are stored in the datastore and can be exported on demand. See https://bugs.launchpad.net/oq-engine/+bug/1452363.\r\nThe tests are running here: https://ci.openquake.org/job/zdevel_oq-risklib/619/\r\n\r\nPS: also closes https://bugs.launchpad.net/oq-engine/+bug/1448580, https://bugs.launchpad.net/oq-engine/+bug/1448584","created_at":"2015-05-13T03:40:39Z","updated_at":"2015-05-20T13:19:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b90e3c614458b067115a3cc2d7b45c387742986","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gem/oq-risklib/pulls/243/commits","review_comments_url":"https://api.github.com/repos/gem/oq-risklib/pulls/243/comments","review_comment_url":"https://api.github.com/repos/gem/oq-risklib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gem/oq-risklib/issues/243/comments","statuses_url":"https://api.github.com/repos/gem/oq-risklib/statuses/4e770b51afd5b31cc74e5ee13e34ed973dd661d4","head":{"label":"gem:precalculator2","ref":"precalculator2","sha":"4e770b51afd5b31cc74e5ee13e34ed973dd661d4","user":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"repo":{"id":5856509,"name":"oq-risklib","full_name":"gem/oq-risklib","owner":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gem/oq-risklib","description":"OpenQuake Risk Library","fork":false,"url":"https://api.github.com/repos/gem/oq-risklib","forks_url":"https://api.github.com/repos/gem/oq-risklib/forks","keys_url":"https://api.github.com/repos/gem/oq-risklib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gem/oq-risklib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gem/oq-risklib/teams","hooks_url":"https://api.github.com/repos/gem/oq-risklib/hooks","issue_events_url":"https://api.github.com/repos/gem/oq-risklib/issues/events{/number}","events_url":"https://api.github.com/repos/gem/oq-risklib/events","assignees_url":"https://api.github.com/repos/gem/oq-risklib/assignees{/user}","branches_url":"https://api.github.com/repos/gem/oq-risklib/branches{/branch}","tags_url":"https://api.github.com/repos/gem/oq-risklib/tags","blobs_url":"https://api.github.com/repos/gem/oq-risklib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gem/oq-risklib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gem/oq-risklib/git/refs{/sha}","trees_url":"https://api.github.com/repos/gem/oq-risklib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gem/oq-risklib/statuses/{sha}","languages_url":"https://api.github.com/repos/gem/oq-risklib/languages","stargazers_url":"https://api.github.com/repos/gem/oq-risklib/stargazers","contributors_url":"https://api.github.com/repos/gem/oq-risklib/contributors","subscribers_url":"https://api.github.com/repos/gem/oq-risklib/subscribers","subscription_url":"https://api.github.com/repos/gem/oq-risklib/subscription","commits_url":"https://api.github.com/repos/gem/oq-risklib/commits{/sha}","git_commits_url":"https://api.github.com/repos/gem/oq-risklib/git/commits{/sha}","comments_url":"https://api.github.com/repos/gem/oq-risklib/comments{/number}","issue_comment_url":"https://api.github.com/repos/gem/oq-risklib/issues/comments{/number}","contents_url":"https://api.github.com/repos/gem/oq-risklib/contents/{+path}","compare_url":"https://api.github.com/repos/gem/oq-risklib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gem/oq-risklib/merges","archive_url":"https://api.github.com/repos/gem/oq-risklib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gem/oq-risklib/downloads","issues_url":"https://api.github.com/repos/gem/oq-risklib/issues{/number}","pulls_url":"https://api.github.com/repos/gem/oq-risklib/pulls{/number}","milestones_url":"https://api.github.com/repos/gem/oq-risklib/milestones{/number}","notifications_url":"https://api.github.com/repos/gem/oq-risklib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gem/oq-risklib/labels{/name}","releases_url":"https://api.github.com/repos/gem/oq-risklib/releases{/id}","created_at":"2012-09-18T13:07:14Z","updated_at":"2015-05-08T14:27:00Z","pushed_at":"2015-05-20T12:58:44Z","git_url":"git://github.com/gem/oq-risklib.git","ssh_url":"git@github.com:gem/oq-risklib.git","clone_url":"https://github.com/gem/oq-risklib.git","svn_url":"https://github.com/gem/oq-risklib","homepage":"http://www.globalquakemodel.org/openquake/","size":28560,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":2,"forks":11,"open_issues":2,"watchers":8,"default_branch":"master"}},"base":{"label":"gem:master","ref":"master","sha":"225bcf59d374e7a9411b0ab9cfb3c44ebc13b07b","user":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"repo":{"id":5856509,"name":"oq-risklib","full_name":"gem/oq-risklib","owner":{"login":"gem","id":316546,"avatar_url":"https://avatars.githubusercontent.com/u/316546?v=3","gravatar_id":"","url":"https://api.github.com/users/gem","html_url":"https://github.com/gem","followers_url":"https://api.github.com/users/gem/followers","following_url":"https://api.github.com/users/gem/following{/other_user}","gists_url":"https://api.github.com/users/gem/gists{/gist_id}","starred_url":"https://api.github.com/users/gem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gem/subscriptions","organizations_url":"https://api.github.com/users/gem/orgs","repos_url":"https://api.github.com/users/gem/repos","events_url":"https://api.github.com/users/gem/events{/privacy}","received_events_url":"https://api.github.com/users/gem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gem/oq-risklib","description":"OpenQuake Risk Library","fork":false,"url":"https://api.github.com/repos/gem/oq-risklib","forks_url":"https://api.github.com/repos/gem/oq-risklib/forks","keys_url":"https://api.github.com/repos/gem/oq-risklib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gem/oq-risklib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gem/oq-risklib/teams","hooks_url":"https://api.github.com/repos/gem/oq-risklib/hooks","issue_events_url":"https://api.github.com/repos/gem/oq-risklib/issues/events{/number}","events_url":"https://api.github.com/repos/gem/oq-risklib/events","assignees_url":"https://api.github.com/repos/gem/oq-risklib/assignees{/user}","branches_url":"https://api.github.com/repos/gem/oq-risklib/branches{/branch}","tags_url":"https://api.github.com/repos/gem/oq-risklib/tags","blobs_url":"https://api.github.com/repos/gem/oq-risklib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gem/oq-risklib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gem/oq-risklib/git/refs{/sha}","trees_url":"https://api.github.com/repos/gem/oq-risklib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gem/oq-risklib/statuses/{sha}","languages_url":"https://api.github.com/repos/gem/oq-risklib/languages","stargazers_url":"https://api.github.com/repos/gem/oq-risklib/stargazers","contributors_url":"https://api.github.com/repos/gem/oq-risklib/contributors","subscribers_url":"https://api.github.com/repos/gem/oq-risklib/subscribers","subscription_url":"https://api.github.com/repos/gem/oq-risklib/subscription","commits_url":"https://api.github.com/repos/gem/oq-risklib/commits{/sha}","git_commits_url":"https://api.github.com/repos/gem/oq-risklib/git/commits{/sha}","comments_url":"https://api.github.com/repos/gem/oq-risklib/comments{/number}","issue_comment_url":"https://api.github.com/repos/gem/oq-risklib/issues/comments{/number}","contents_url":"https://api.github.com/repos/gem/oq-risklib/contents/{+path}","compare_url":"https://api.github.com/repos/gem/oq-risklib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gem/oq-risklib/merges","archive_url":"https://api.github.com/repos/gem/oq-risklib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gem/oq-risklib/downloads","issues_url":"https://api.github.com/repos/gem/oq-risklib/issues{/number}","pulls_url":"https://api.github.com/repos/gem/oq-risklib/pulls{/number}","milestones_url":"https://api.github.com/repos/gem/oq-risklib/milestones{/number}","notifications_url":"https://api.github.com/repos/gem/oq-risklib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gem/oq-risklib/labels{/name}","releases_url":"https://api.github.com/repos/gem/oq-risklib/releases{/id}","created_at":"2012-09-18T13:07:14Z","updated_at":"2015-05-08T14:27:00Z","pushed_at":"2015-05-20T12:58:44Z","git_url":"git://github.com/gem/oq-risklib.git","ssh_url":"git@github.com:gem/oq-risklib.git","clone_url":"https://github.com/gem/oq-risklib.git","svn_url":"https://github.com/gem/oq-risklib","homepage":"http://www.globalquakemodel.org/openquake/","size":28560,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":2,"forks":11,"open_issues":2,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/243"},"html":{"href":"https://github.com/gem/oq-risklib/pull/243"},"issue":{"href":"https://api.github.com/repos/gem/oq-risklib/issues/243"},"comments":{"href":"https://api.github.com/repos/gem/oq-risklib/issues/243/comments"},"review_comments":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/243/comments"},"review_comment":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gem/oq-risklib/pulls/243/commits"},"statuses":{"href":"https://api.github.com/repos/gem/oq-risklib/statuses/4e770b51afd5b31cc74e5ee13e34ed973dd661d4"}}}}