{"action":"created","comment":{"url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/comments/165651454","pull_request_review_id":93628567,"id":165651454,"diff_hunk":"@@ -72,5 +85,34 @@ public TranslatedStatement translateSQL(SourceStatement sourceStatement) {\n             return parameterValues.toArray(new String[parameterValues.size()]);\n         }\n     }\n-    \n+\n+    @GET\n+    @Path(\"/generate-result/{target}/{schema}\")\n+    @Produces(\"text/plain\")\n+    public String generateResultSQL(@PathParam(\"target\") String target, @PathParam(\"schema\") String schema) throws IOException {\n+\n+        String sql = translateSqlFile(\"classpath://db/cohort_results/cohort_feasiblity.sql\", target, schema);\n+        sql += \"\\n\" + translateSqlFile(\"classpath://db/cohort_results/cohort_features_results.sql\", target, schema);\n+        sql += \"\\n\" + translateSqlFile(\"classpath://db/cohort_results/ir_analysis.sql\", target, schema);\n+        sql += \"\\n\" + translateSqlFile(\"classpath://db/cohort_results/createHeraclesTables.sql\", target, schema);\n+        if (!REDSHIFT.equalsIgnoreCase(target)) {\n+            sql += \"\\n\" + translateSqlFile(\"classpath://db/cohort_results/heracles_indexes.sql\", target, schema);\n+        }\n+        return sql.replaceAll(\";\", \";\\n\");\n+    }\n+\n+    private String translateSqlFile(String resource, String target, String schema) throws IOException {\n+\n+        Resource cohortFeasibilitySql = applicationContext.getResource(resource);\n+        SourceStatement statement = new SourceStatement();\n+        statement.targetDialect = target;\n+        try(InputStream in = new FileInputStream(cohortFeasibilitySql.getFile())) {\n+            statement.sql = IOUtils.toString(in);","path":"src/main/java/org/ohdsi/webapi/service/SqlRenderService.java","position":null,"original_position":74,"commit_id":"42387cf3f4ab16870955a9bb21a0270b6d3ce5d6","original_commit_id":"c98dddf09b18a6ef0e755c69ede81b392ad2d13a","user":{"login":"mpozhidaeva","id":31308645,"avatar_url":"https://avatars2.githubusercontent.com/u/31308645?v=4","gravatar_id":"","url":"https://api.github.com/users/mpozhidaeva","html_url":"https://github.com/mpozhidaeva","followers_url":"https://api.github.com/users/mpozhidaeva/followers","following_url":"https://api.github.com/users/mpozhidaeva/following{/other_user}","gists_url":"https://api.github.com/users/mpozhidaeva/gists{/gist_id}","starred_url":"https://api.github.com/users/mpozhidaeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpozhidaeva/subscriptions","organizations_url":"https://api.github.com/users/mpozhidaeva/orgs","repos_url":"https://api.github.com/users/mpozhidaeva/repos","events_url":"https://api.github.com/users/mpozhidaeva/events{/privacy}","received_events_url":"https://api.github.com/users/mpozhidaeva/received_events","type":"User","site_admin":false},"body":"In fact your proposed code looks better - thanks!\r\nUpdated.","created_at":"2018-02-02T14:01:15Z","updated_at":"2018-02-02T14:01:15Z","html_url":"https://github.com/OHDSI/WebAPI/pull/289#discussion_r165651454","pull_request_url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/comments/165651454"},"html":{"href":"https://github.com/OHDSI/WebAPI/pull/289#discussion_r165651454"},"pull_request":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289"}},"in_reply_to_id":165087751},"pull_request":{"url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289","id":159138339,"html_url":"https://github.com/OHDSI/WebAPI/pull/289","diff_url":"https://github.com/OHDSI/WebAPI/pull/289.diff","patch_url":"https://github.com/OHDSI/WebAPI/pull/289.patch","issue_url":"https://api.github.com/repos/OHDSI/WebAPI/issues/289","number":289,"state":"open","locked":false,"title":"Add REST endpoint, which generates DDL for Result schema #285","user":{"login":"mpozhidaeva","id":31308645,"avatar_url":"https://avatars2.githubusercontent.com/u/31308645?v=4","gravatar_id":"","url":"https://api.github.com/users/mpozhidaeva","html_url":"https://github.com/mpozhidaeva","followers_url":"https://api.github.com/users/mpozhidaeva/followers","following_url":"https://api.github.com/users/mpozhidaeva/following{/other_user}","gists_url":"https://api.github.com/users/mpozhidaeva/gists{/gist_id}","starred_url":"https://api.github.com/users/mpozhidaeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpozhidaeva/subscriptions","organizations_url":"https://api.github.com/users/mpozhidaeva/orgs","repos_url":"https://api.github.com/users/mpozhidaeva/repos","events_url":"https://api.github.com/users/mpozhidaeva/events{/privacy}","received_events_url":"https://api.github.com/users/mpozhidaeva/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-12-19T11:05:30Z","updated_at":"2018-02-02T14:01:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ea3c05bdd7cb02fd74075c137c4966b6d972cbb","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289/commits","review_comments_url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289/comments","review_comment_url":"https://api.github.com/repos/OHDSI/WebAPI/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OHDSI/WebAPI/issues/289/comments","statuses_url":"https://api.github.com/repos/OHDSI/WebAPI/statuses/42387cf3f4ab16870955a9bb21a0270b6d3ce5d6","head":{"label":"odysseusinc:result-tables","ref":"result-tables","sha":"42387cf3f4ab16870955a9bb21a0270b6d3ce5d6","user":{"login":"odysseusinc","id":29594955,"avatar_url":"https://avatars3.githubusercontent.com/u/29594955?v=4","gravatar_id":"","url":"https://api.github.com/users/odysseusinc","html_url":"https://github.com/odysseusinc","followers_url":"https://api.github.com/users/odysseusinc/followers","following_url":"https://api.github.com/users/odysseusinc/following{/other_user}","gists_url":"https://api.github.com/users/odysseusinc/gists{/gist_id}","starred_url":"https://api.github.com/users/odysseusinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odysseusinc/subscriptions","organizations_url":"https://api.github.com/users/odysseusinc/orgs","repos_url":"https://api.github.com/users/odysseusinc/repos","events_url":"https://api.github.com/users/odysseusinc/events{/privacy}","received_events_url":"https://api.github.com/users/odysseusinc/received_events","type":"Organization","site_admin":false},"repo":{"id":100928476,"name":"WebAPI","full_name":"odysseusinc/WebAPI","owner":{"login":"odysseusinc","id":29594955,"avatar_url":"https://avatars3.githubusercontent.com/u/29594955?v=4","gravatar_id":"","url":"https://api.github.com/users/odysseusinc","html_url":"https://github.com/odysseusinc","followers_url":"https://api.github.com/users/odysseusinc/followers","following_url":"https://api.github.com/users/odysseusinc/following{/other_user}","gists_url":"https://api.github.com/users/odysseusinc/gists{/gist_id}","starred_url":"https://api.github.com/users/odysseusinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odysseusinc/subscriptions","organizations_url":"https://api.github.com/users/odysseusinc/orgs","repos_url":"https://api.github.com/users/odysseusinc/repos","events_url":"https://api.github.com/users/odysseusinc/events{/privacy}","received_events_url":"https://api.github.com/users/odysseusinc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odysseusinc/WebAPI","description":"[Under development] OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applications","fork":true,"url":"https://api.github.com/repos/odysseusinc/WebAPI","forks_url":"https://api.github.com/repos/odysseusinc/WebAPI/forks","keys_url":"https://api.github.com/repos/odysseusinc/WebAPI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odysseusinc/WebAPI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odysseusinc/WebAPI/teams","hooks_url":"https://api.github.com/repos/odysseusinc/WebAPI/hooks","issue_events_url":"https://api.github.com/repos/odysseusinc/WebAPI/issues/events{/number}","events_url":"https://api.github.com/repos/odysseusinc/WebAPI/events","assignees_url":"https://api.github.com/repos/odysseusinc/WebAPI/assignees{/user}","branches_url":"https://api.github.com/repos/odysseusinc/WebAPI/branches{/branch}","tags_url":"https://api.github.com/repos/odysseusinc/WebAPI/tags","blobs_url":"https://api.github.com/repos/odysseusinc/WebAPI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odysseusinc/WebAPI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odysseusinc/WebAPI/git/refs{/sha}","trees_url":"https://api.github.com/repos/odysseusinc/WebAPI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odysseusinc/WebAPI/statuses/{sha}","languages_url":"https://api.github.com/repos/odysseusinc/WebAPI/languages","stargazers_url":"https://api.github.com/repos/odysseusinc/WebAPI/stargazers","contributors_url":"https://api.github.com/repos/odysseusinc/WebAPI/contributors","subscribers_url":"https://api.github.com/repos/odysseusinc/WebAPI/subscribers","subscription_url":"https://api.github.com/repos/odysseusinc/WebAPI/subscription","commits_url":"https://api.github.com/repos/odysseusinc/WebAPI/commits{/sha}","git_commits_url":"https://api.github.com/repos/odysseusinc/WebAPI/git/commits{/sha}","comments_url":"https://api.github.com/repos/odysseusinc/WebAPI/comments{/number}","issue_comment_url":"https://api.github.com/repos/odysseusinc/WebAPI/issues/comments{/number}","contents_url":"https://api.github.com/repos/odysseusinc/WebAPI/contents/{+path}","compare_url":"https://api.github.com/repos/odysseusinc/WebAPI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odysseusinc/WebAPI/merges","archive_url":"https://api.github.com/repos/odysseusinc/WebAPI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odysseusinc/WebAPI/downloads","issues_url":"https://api.github.com/repos/odysseusinc/WebAPI/issues{/number}","pulls_url":"https://api.github.com/repos/odysseusinc/WebAPI/pulls{/number}","milestones_url":"https://api.github.com/repos/odysseusinc/WebAPI/milestones{/number}","notifications_url":"https://api.github.com/repos/odysseusinc/WebAPI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odysseusinc/WebAPI/labels{/name}","releases_url":"https://api.github.com/repos/odysseusinc/WebAPI/releases{/id}","deployments_url":"https://api.github.com/repos/odysseusinc/WebAPI/deployments","created_at":"2017-08-21T08:05:03Z","updated_at":"2017-08-21T08:05:06Z","pushed_at":"2018-02-02T13:51:00Z","git_url":"git://github.com/odysseusinc/WebAPI.git","ssh_url":"git@github.com:odysseusinc/WebAPI.git","clone_url":"https://github.com/odysseusinc/WebAPI.git","svn_url":"https://github.com/odysseusinc/WebAPI","homepage":"","size":2994,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"OHDSI:rc_2.3","ref":"rc_2.3","sha":"9e7ef9bf383d17d35c760e21929b4107391e1e67","user":{"login":"OHDSI","id":6570077,"avatar_url":"https://avatars1.githubusercontent.com/u/6570077?v=4","gravatar_id":"","url":"https://api.github.com/users/OHDSI","html_url":"https://github.com/OHDSI","followers_url":"https://api.github.com/users/OHDSI/followers","following_url":"https://api.github.com/users/OHDSI/following{/other_user}","gists_url":"https://api.github.com/users/OHDSI/gists{/gist_id}","starred_url":"https://api.github.com/users/OHDSI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OHDSI/subscriptions","organizations_url":"https://api.github.com/users/OHDSI/orgs","repos_url":"https://api.github.com/users/OHDSI/repos","events_url":"https://api.github.com/users/OHDSI/events{/privacy}","received_events_url":"https://api.github.com/users/OHDSI/received_events","type":"Organization","site_admin":false},"repo":{"id":27504653,"name":"WebAPI","full_name":"OHDSI/WebAPI","owner":{"login":"OHDSI","id":6570077,"avatar_url":"https://avatars1.githubusercontent.com/u/6570077?v=4","gravatar_id":"","url":"https://api.github.com/users/OHDSI","html_url":"https://github.com/OHDSI","followers_url":"https://api.github.com/users/OHDSI/followers","following_url":"https://api.github.com/users/OHDSI/following{/other_user}","gists_url":"https://api.github.com/users/OHDSI/gists{/gist_id}","starred_url":"https://api.github.com/users/OHDSI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OHDSI/subscriptions","organizations_url":"https://api.github.com/users/OHDSI/orgs","repos_url":"https://api.github.com/users/OHDSI/repos","events_url":"https://api.github.com/users/OHDSI/events{/privacy}","received_events_url":"https://api.github.com/users/OHDSI/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OHDSI/WebAPI","description":"[Under development] OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applications","fork":false,"url":"https://api.github.com/repos/OHDSI/WebAPI","forks_url":"https://api.github.com/repos/OHDSI/WebAPI/forks","keys_url":"https://api.github.com/repos/OHDSI/WebAPI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OHDSI/WebAPI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OHDSI/WebAPI/teams","hooks_url":"https://api.github.com/repos/OHDSI/WebAPI/hooks","issue_events_url":"https://api.github.com/repos/OHDSI/WebAPI/issues/events{/number}","events_url":"https://api.github.com/repos/OHDSI/WebAPI/events","assignees_url":"https://api.github.com/repos/OHDSI/WebAPI/assignees{/user}","branches_url":"https://api.github.com/repos/OHDSI/WebAPI/branches{/branch}","tags_url":"https://api.github.com/repos/OHDSI/WebAPI/tags","blobs_url":"https://api.github.com/repos/OHDSI/WebAPI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OHDSI/WebAPI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OHDSI/WebAPI/git/refs{/sha}","trees_url":"https://api.github.com/repos/OHDSI/WebAPI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OHDSI/WebAPI/statuses/{sha}","languages_url":"https://api.github.com/repos/OHDSI/WebAPI/languages","stargazers_url":"https://api.github.com/repos/OHDSI/WebAPI/stargazers","contributors_url":"https://api.github.com/repos/OHDSI/WebAPI/contributors","subscribers_url":"https://api.github.com/repos/OHDSI/WebAPI/subscribers","subscription_url":"https://api.github.com/repos/OHDSI/WebAPI/subscription","commits_url":"https://api.github.com/repos/OHDSI/WebAPI/commits{/sha}","git_commits_url":"https://api.github.com/repos/OHDSI/WebAPI/git/commits{/sha}","comments_url":"https://api.github.com/repos/OHDSI/WebAPI/comments{/number}","issue_comment_url":"https://api.github.com/repos/OHDSI/WebAPI/issues/comments{/number}","contents_url":"https://api.github.com/repos/OHDSI/WebAPI/contents/{+path}","compare_url":"https://api.github.com/repos/OHDSI/WebAPI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OHDSI/WebAPI/merges","archive_url":"https://api.github.com/repos/OHDSI/WebAPI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OHDSI/WebAPI/downloads","issues_url":"https://api.github.com/repos/OHDSI/WebAPI/issues{/number}","pulls_url":"https://api.github.com/repos/OHDSI/WebAPI/pulls{/number}","milestones_url":"https://api.github.com/repos/OHDSI/WebAPI/milestones{/number}","notifications_url":"https://api.github.com/repos/OHDSI/WebAPI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OHDSI/WebAPI/labels{/name}","releases_url":"https://api.github.com/repos/OHDSI/WebAPI/releases{/id}","deployments_url":"https://api.github.com/repos/OHDSI/WebAPI/deployments","created_at":"2014-12-03T19:49:51Z","updated_at":"2018-01-16T22:32:02Z","pushed_at":"2018-02-02T13:51:00Z","git_url":"git://github.com/OHDSI/WebAPI.git","ssh_url":"git@github.com:OHDSI/WebAPI.git","clone_url":"https://github.com/OHDSI/WebAPI.git","svn_url":"https://github.com/OHDSI/WebAPI","homepage":"","size":3231,"stargazers_count":29,"watchers_count":29,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":78,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":41,"open_issues":78,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289"},"html":{"href":"https://github.com/OHDSI/WebAPI/pull/289"},"issue":{"href":"https://api.github.com/repos/OHDSI/WebAPI/issues/289"},"comments":{"href":"https://api.github.com/repos/OHDSI/WebAPI/issues/289/comments"},"review_comments":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289/comments"},"review_comment":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OHDSI/WebAPI/pulls/289/commits"},"statuses":{"href":"https://api.github.com/repos/OHDSI/WebAPI/statuses/42387cf3f4ab16870955a9bb21a0270b6d3ce5d6"}},"author_association":"NONE"}}
{"actor":{"display_login":"mpozhidaeva"}}