{"action":"created","comment":{"url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/comments/88984744","pull_request_review_id":9539222,"id":88984744,"diff_hunk":"@@ -5,22 +5,32 @@ import gem.enum.Instrument\n \n import doobie.imports._\n \n+import scalaz._, Scalaz._\n+\n object ObservationDao {\n \n   def insert(o: Observation[_]): ConnectionIO[Int] =\n     sql\"\"\"\n-      INSERT INTO observation (observation_id, \n-                              program_id, \n-                              observation_index, \n+      INSERT INTO observation (observation_id,\n+                              program_id,\n+                              observation_index,\n                               title,\n                               instrument)\n-            VALUES (${o.id}, \n-                    ${o.id.pid}, \n-                    ${o.id.index}, \n+            VALUES (${o.id},\n+                    ${o.id.pid},\n+                    ${o.id.index},\n                     ${o.title},\n                     ${o.instrument})\n     \"\"\".update.run\n \n+  /** Select all the observation ids associated with the given program. */\n+  def selectIds(pid: Program.Id): ConnectionIO[List[Observation.Id]] =\n+    sql\"\"\"\n+      SELECT observation_id\n+        FROM observation\n+       WHERE program_id = $pid\n+    \"\"\".query[Observation.Id].list\n+\n   def selectFlat(id: Observation.Id): ConnectionIO[Observation[Nothing]] =","path":"modules/db/src/main/scala/gem/dao/ObservationDao.scala","position":36,"original_position":36,"commit_id":"3ff0426b8bf0ee574957d9d5ae269e92c720770e","original_commit_id":"3ff0426b8bf0ee574957d9d5ae269e92c720770e","user":{"login":"swalker2m","id":4906023,"avatar_url":"https://avatars.githubusercontent.com/u/4906023?v=3","gravatar_id":"","url":"https://api.github.com/users/swalker2m","html_url":"https://github.com/swalker2m","followers_url":"https://api.github.com/users/swalker2m/followers","following_url":"https://api.github.com/users/swalker2m/following{/other_user}","gists_url":"https://api.github.com/users/swalker2m/gists{/gist_id}","starred_url":"https://api.github.com/users/swalker2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swalker2m/subscriptions","organizations_url":"https://api.github.com/users/swalker2m/orgs","repos_url":"https://api.github.com/users/swalker2m/repos","events_url":"https://api.github.com/users/swalker2m/events{/privacy}","received_events_url":"https://api.github.com/users/swalker2m/received_events","type":"User","site_admin":false},"body":"Right, it is devoid of `Step` information for the sequence.  The idea (from Rob) was to be able to query for just the information you need rather than having to pull out everything any time you want anything.  The same scheme exists for `Program`, as in `Program[Nothing]` if you're not interested in observation details.","created_at":"2016-11-21T20:50:50Z","updated_at":"2016-11-21T20:50:50Z","html_url":"https://github.com/gemini-hlsw/gem/pull/21#discussion_r88984744","pull_request_url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/comments/88984744"},"html":{"href":"https://github.com/gemini-hlsw/gem/pull/21#discussion_r88984744"},"pull_request":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21","id":94689147,"html_url":"https://github.com/gemini-hlsw/gem/pull/21","diff_url":"https://github.com/gemini-hlsw/gem/pull/21.diff","patch_url":"https://github.com/gemini-hlsw/gem/pull/21.patch","issue_url":"https://api.github.com/repos/gemini-hlsw/gem/issues/21","number":21,"state":"open","locked":false,"title":"Program DAO selectFull","user":{"login":"swalker2m","id":4906023,"avatar_url":"https://avatars.githubusercontent.com/u/4906023?v=3","gravatar_id":"","url":"https://api.github.com/users/swalker2m","html_url":"https://github.com/swalker2m","followers_url":"https://api.github.com/users/swalker2m/followers","following_url":"https://api.github.com/users/swalker2m/following{/other_user}","gists_url":"https://api.github.com/users/swalker2m/gists{/gist_id}","starred_url":"https://api.github.com/users/swalker2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swalker2m/subscriptions","organizations_url":"https://api.github.com/users/swalker2m/orgs","repos_url":"https://api.github.com/users/swalker2m/repos","events_url":"https://api.github.com/users/swalker2m/events{/privacy}","received_events_url":"https://api.github.com/users/swalker2m/received_events","type":"User","site_admin":false},"body":"This PR contains a bug fix for the `StepDao` and a simple proposal for reworking `ProgramDao.selectFull`.    Previously `selectFull` referenced (or pretends to reference) all step fields in all tables in a single query building up a `Program[Observation[Step[_]]]` result.  This is clearly not complete now and not scalable going forward but the right way to do this also isn't obvious to me.  I'm proposing a straightforward change to multiple small queries.  If there is a better way, please let me know.","created_at":"2016-11-21T20:20:43Z","updated_at":"2016-11-21T20:50:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a1a837246479078b3390b0eec3eeb76bb180e8b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21/commits","review_comments_url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21/comments","review_comment_url":"https://api.github.com/repos/gemini-hlsw/gem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gemini-hlsw/gem/issues/21/comments","statuses_url":"https://api.github.com/repos/gemini-hlsw/gem/statuses/3ff0426b8bf0ee574957d9d5ae269e92c720770e","head":{"label":"swalker2m:program_dao_select_full","ref":"program_dao_select_full","sha":"3ff0426b8bf0ee574957d9d5ae269e92c720770e","user":{"login":"swalker2m","id":4906023,"avatar_url":"https://avatars.githubusercontent.com/u/4906023?v=3","gravatar_id":"","url":"https://api.github.com/users/swalker2m","html_url":"https://github.com/swalker2m","followers_url":"https://api.github.com/users/swalker2m/followers","following_url":"https://api.github.com/users/swalker2m/following{/other_user}","gists_url":"https://api.github.com/users/swalker2m/gists{/gist_id}","starred_url":"https://api.github.com/users/swalker2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swalker2m/subscriptions","organizations_url":"https://api.github.com/users/swalker2m/orgs","repos_url":"https://api.github.com/users/swalker2m/repos","events_url":"https://api.github.com/users/swalker2m/events{/privacy}","received_events_url":"https://api.github.com/users/swalker2m/received_events","type":"User","site_admin":false},"repo":{"id":67809504,"name":"gem","full_name":"swalker2m/gem","owner":{"login":"swalker2m","id":4906023,"avatar_url":"https://avatars.githubusercontent.com/u/4906023?v=3","gravatar_id":"","url":"https://api.github.com/users/swalker2m","html_url":"https://github.com/swalker2m","followers_url":"https://api.github.com/users/swalker2m/followers","following_url":"https://api.github.com/users/swalker2m/following{/other_user}","gists_url":"https://api.github.com/users/swalker2m/gists{/gist_id}","starred_url":"https://api.github.com/users/swalker2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swalker2m/subscriptions","organizations_url":"https://api.github.com/users/swalker2m/orgs","repos_url":"https://api.github.com/users/swalker2m/repos","events_url":"https://api.github.com/users/swalker2m/events{/privacy}","received_events_url":"https://api.github.com/users/swalker2m/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/swalker2m/gem","description":"prototype postgres back-end for ocs","fork":true,"url":"https://api.github.com/repos/swalker2m/gem","forks_url":"https://api.github.com/repos/swalker2m/gem/forks","keys_url":"https://api.github.com/repos/swalker2m/gem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swalker2m/gem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swalker2m/gem/teams","hooks_url":"https://api.github.com/repos/swalker2m/gem/hooks","issue_events_url":"https://api.github.com/repos/swalker2m/gem/issues/events{/number}","events_url":"https://api.github.com/repos/swalker2m/gem/events","assignees_url":"https://api.github.com/repos/swalker2m/gem/assignees{/user}","branches_url":"https://api.github.com/repos/swalker2m/gem/branches{/branch}","tags_url":"https://api.github.com/repos/swalker2m/gem/tags","blobs_url":"https://api.github.com/repos/swalker2m/gem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swalker2m/gem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swalker2m/gem/git/refs{/sha}","trees_url":"https://api.github.com/repos/swalker2m/gem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swalker2m/gem/statuses/{sha}","languages_url":"https://api.github.com/repos/swalker2m/gem/languages","stargazers_url":"https://api.github.com/repos/swalker2m/gem/stargazers","contributors_url":"https://api.github.com/repos/swalker2m/gem/contributors","subscribers_url":"https://api.github.com/repos/swalker2m/gem/subscribers","subscription_url":"https://api.github.com/repos/swalker2m/gem/subscription","commits_url":"https://api.github.com/repos/swalker2m/gem/commits{/sha}","git_commits_url":"https://api.github.com/repos/swalker2m/gem/git/commits{/sha}","comments_url":"https://api.github.com/repos/swalker2m/gem/comments{/number}","issue_comment_url":"https://api.github.com/repos/swalker2m/gem/issues/comments{/number}","contents_url":"https://api.github.com/repos/swalker2m/gem/contents/{+path}","compare_url":"https://api.github.com/repos/swalker2m/gem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swalker2m/gem/merges","archive_url":"https://api.github.com/repos/swalker2m/gem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swalker2m/gem/downloads","issues_url":"https://api.github.com/repos/swalker2m/gem/issues{/number}","pulls_url":"https://api.github.com/repos/swalker2m/gem/pulls{/number}","milestones_url":"https://api.github.com/repos/swalker2m/gem/milestones{/number}","notifications_url":"https://api.github.com/repos/swalker2m/gem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swalker2m/gem/labels{/name}","releases_url":"https://api.github.com/repos/swalker2m/gem/releases{/id}","deployments_url":"https://api.github.com/repos/swalker2m/gem/deployments","created_at":"2016-09-09T15:16:47Z","updated_at":"2016-09-09T15:16:49Z","pushed_at":"2016-11-21T20:12:46Z","git_url":"git://github.com/swalker2m/gem.git","ssh_url":"git@github.com:swalker2m/gem.git","clone_url":"https://github.com/swalker2m/gem.git","svn_url":"https://github.com/swalker2m/gem","homepage":null,"size":6918,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gemini-hlsw:master","ref":"master","sha":"080e23319d8c9423aa5193f9d29e2763623ee5e6","user":{"login":"gemini-hlsw","id":8593735,"avatar_url":"https://avatars.githubusercontent.com/u/8593735?v=3","gravatar_id":"","url":"https://api.github.com/users/gemini-hlsw","html_url":"https://github.com/gemini-hlsw","followers_url":"https://api.github.com/users/gemini-hlsw/followers","following_url":"https://api.github.com/users/gemini-hlsw/following{/other_user}","gists_url":"https://api.github.com/users/gemini-hlsw/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-hlsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-hlsw/subscriptions","organizations_url":"https://api.github.com/users/gemini-hlsw/orgs","repos_url":"https://api.github.com/users/gemini-hlsw/repos","events_url":"https://api.github.com/users/gemini-hlsw/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-hlsw/received_events","type":"Organization","site_admin":false},"repo":{"id":65769268,"name":"gem","full_name":"gemini-hlsw/gem","owner":{"login":"gemini-hlsw","id":8593735,"avatar_url":"https://avatars.githubusercontent.com/u/8593735?v=3","gravatar_id":"","url":"https://api.github.com/users/gemini-hlsw","html_url":"https://github.com/gemini-hlsw","followers_url":"https://api.github.com/users/gemini-hlsw/followers","following_url":"https://api.github.com/users/gemini-hlsw/following{/other_user}","gists_url":"https://api.github.com/users/gemini-hlsw/gists{/gist_id}","starred_url":"https://api.github.com/users/gemini-hlsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gemini-hlsw/subscriptions","organizations_url":"https://api.github.com/users/gemini-hlsw/orgs","repos_url":"https://api.github.com/users/gemini-hlsw/repos","events_url":"https://api.github.com/users/gemini-hlsw/events{/privacy}","received_events_url":"https://api.github.com/users/gemini-hlsw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gemini-hlsw/gem","description":"prototype postgres back-end for ocs","fork":false,"url":"https://api.github.com/repos/gemini-hlsw/gem","forks_url":"https://api.github.com/repos/gemini-hlsw/gem/forks","keys_url":"https://api.github.com/repos/gemini-hlsw/gem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-hlsw/gem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-hlsw/gem/teams","hooks_url":"https://api.github.com/repos/gemini-hlsw/gem/hooks","issue_events_url":"https://api.github.com/repos/gemini-hlsw/gem/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-hlsw/gem/events","assignees_url":"https://api.github.com/repos/gemini-hlsw/gem/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-hlsw/gem/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-hlsw/gem/tags","blobs_url":"https://api.github.com/repos/gemini-hlsw/gem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-hlsw/gem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-hlsw/gem/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-hlsw/gem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-hlsw/gem/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-hlsw/gem/languages","stargazers_url":"https://api.github.com/repos/gemini-hlsw/gem/stargazers","contributors_url":"https://api.github.com/repos/gemini-hlsw/gem/contributors","subscribers_url":"https://api.github.com/repos/gemini-hlsw/gem/subscribers","subscription_url":"https://api.github.com/repos/gemini-hlsw/gem/subscription","commits_url":"https://api.github.com/repos/gemini-hlsw/gem/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-hlsw/gem/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-hlsw/gem/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-hlsw/gem/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-hlsw/gem/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-hlsw/gem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-hlsw/gem/merges","archive_url":"https://api.github.com/repos/gemini-hlsw/gem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-hlsw/gem/downloads","issues_url":"https://api.github.com/repos/gemini-hlsw/gem/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-hlsw/gem/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-hlsw/gem/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-hlsw/gem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-hlsw/gem/labels{/name}","releases_url":"https://api.github.com/repos/gemini-hlsw/gem/releases{/id}","deployments_url":"https://api.github.com/repos/gemini-hlsw/gem/deployments","created_at":"2016-08-15T22:29:54Z","updated_at":"2016-08-15T22:30:32Z","pushed_at":"2016-11-21T20:20:43Z","git_url":"git://github.com/gemini-hlsw/gem.git","ssh_url":"git@github.com:gemini-hlsw/gem.git","clone_url":"https://github.com/gemini-hlsw/gem.git","svn_url":"https://github.com/gemini-hlsw/gem","homepage":null,"size":6939,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21"},"html":{"href":"https://github.com/gemini-hlsw/gem/pull/21"},"issue":{"href":"https://api.github.com/repos/gemini-hlsw/gem/issues/21"},"comments":{"href":"https://api.github.com/repos/gemini-hlsw/gem/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gemini-hlsw/gem/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/gemini-hlsw/gem/statuses/3ff0426b8bf0ee574957d9d5ae269e92c720770e"}}}}
{"actor":{"display_login":"swalker2m"}}