{"action":"created","comment":{"url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments/40430513","id":40430513,"diff_hunk":"@@ -48,53 +49,114 @@ object VoTableParser extends VoTableParser {\n   /**\n    * parse takes an input stream and attempts to read the xml content and convert it to a VoTable resource\n    */\n-  def parse(url: String, is: InputStream): CatalogResult =\n+  def parse(url: URL, is: InputStream): CatalogResult =\n     validate(is).fold(k => \\/.left(ValidationError(url)), r => \\/.right(parse(XML.loadString(r))))\n }\n \n-// A MagnitudesFilter can ignore fields for certain catalogues and transform others\n-sealed trait MagnitudesFilter {\n-  // Indicates if a field should be ignored\n-  def ignoredMagnitudeField(v: FieldId): Boolean = false\n-  // Indicates if a magnitude is valid\n-  def validMagnitude(m: Magnitude): Boolean = !(m.value.isNaN || m.error.exists(_.isNaN))\n+// A CatalogAdapter improves parsing handling catalog-specific options like parsing magnitudes and selecting key fields\n+sealed trait CatalogAdapter {\n+  // Required fields\n+  val idField: FieldId\n+  val raField: FieldId\n+  val decField: FieldId\n+  val pmRaField = FieldId(\"pmra\", VoTableParser.UCD_PMRA)\n+  val pmDecField = FieldId(\"pmde\", VoTableParser.UCD_PMDEC)\n+\n+  // Indicates if the field is a magnitude\n+  def isMagnitudeField(v: (FieldId, String)): Boolean = containsMagnitude(v._1) && !v._1.ucd.includes(VoTableParser.STAT_ERR) && v._2.nonEmpty\n+  // Indicates if the field is a magnitude error\n+  def isMagnitudeErrorField(v: (FieldId, String)): Boolean = containsMagnitude(v._1) && v._1.ucd.includes(VoTableParser.STAT_ERR) && v._2.nonEmpty\n+  // filter magnitudes as a whole, removing invalid values and duplicates\n+  def filterAndDeduplicateMagnitudes(magnitudeFields: List[(FieldId, Magnitude)]): List[Magnitude] = magnitudeFields.collect { case (_, mag) if validMagnitude(mag) => mag }\n+  // Attempts to extract a band and value for a magnitude from a pair of field and value\n+  def parseMagnitude(p: (FieldId, String)): CatalogProblem \\/ (FieldId, MagnitudeBand, Double) = {\n+    val (fieldId: FieldId, value: String) = p\n+\n+    val band = fieldToBand(fieldId)\n+\n+    for {\n+      b <- band \\/> UnmatchedField(fieldId.ucd)","path":"bundle/edu.gemini.catalog/src/main/scala/edu/gemini/catalog/votable/VoTableParser.scala","position":45,"original_position":45,"commit_id":"742e97c9a58dcdbe82b6e78e54692e1b22b3ee0a","original_commit_id":"742e97c9a58dcdbe82b6e78e54692e1b22b3ee0a","user":{"login":"sraaphorst","id":8795653,"avatar_url":"https://avatars.githubusercontent.com/u/8795653?v=3","gravatar_id":"","url":"https://api.github.com/users/sraaphorst","html_url":"https://github.com/sraaphorst","followers_url":"https://api.github.com/users/sraaphorst/followers","following_url":"https://api.github.com/users/sraaphorst/following{/other_user}","gists_url":"https://api.github.com/users/sraaphorst/gists{/gist_id}","starred_url":"https://api.github.com/users/sraaphorst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sraaphorst/subscriptions","organizations_url":"https://api.github.com/users/sraaphorst/orgs","repos_url":"https://api.github.com/users/sraaphorst/repos","events_url":"https://api.github.com/users/sraaphorst/events{/privacy}","received_events_url":"https://api.github.com/users/sraaphorst/received_events","type":"User","site_admin":false},"body":"A random question: does anyone have a good resource to learn all of this scalaz magic?","created_at":"2015-09-25T13:46:29Z","updated_at":"2015-09-25T13:46:29Z","html_url":"https://github.com/gemini-hlsw/ocs/pull/558#discussion_r40430513","pull_request_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558","_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments/40430513"},"html":{"href":"https://github.com/gemini-hlsw/ocs/pull/558#discussion_r40430513"},"pull_request":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558","id":45817321,"html_url":"https://github.com/gemini-hlsw/ocs/pull/558","diff_url":"https://github.com/gemini-hlsw/ocs/pull/558.diff","patch_url":"https://github.com/gemini-hlsw/ocs/pull/558.patch","issue_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/558","number":558,"state":"open","locked":false,"title":"REL-2382-A: Update Simbad name resolvers","user":{"login":"cquiroz","id":3615303,"avatar_url":"https://avatars.githubusercontent.com/u/3615303?v=3","gravatar_id":"","url":"https://api.github.com/users/cquiroz","html_url":"https://github.com/cquiroz","followers_url":"https://api.github.com/users/cquiroz/followers","following_url":"https://api.github.com/users/cquiroz/following{/other_user}","gists_url":"https://api.github.com/users/cquiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/cquiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cquiroz/subscriptions","organizations_url":"https://api.github.com/users/cquiroz/orgs","repos_url":"https://api.github.com/users/cquiroz/repos","events_url":"https://api.github.com/users/cquiroz/events{/privacy}","received_events_url":"https://api.github.com/users/cquiroz/received_events","type":"User","site_admin":false},"body":"This is the first PR to support Simbad catalogs in the catalog code. This PR contains substantial changes to `VoTableParser` to support simbad VoTable format and initial support to make remote queries no simbad in `VoTableClient`\r\n\r\nThese changes are contained to the catalog bundle, while next PR will include updates to the target model to capture extra metadata about the targets (Radial Velocity, etc) and integration with the OT\r\n\r\nAs usual I include sample votable queries for tests","created_at":"2015-09-23T18:57:48Z","updated_at":"2015-09-25T13:46:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0402d5964afda2635235e65e98f1dcf891c45c95","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558/commits","review_comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558/comments","review_comment_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/558/comments","statuses_url":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/742e97c9a58dcdbe82b6e78e54692e1b22b3ee0a","head":{"label":"cquiroz:feature/REL-2382","ref":"feature/REL-2382","sha":"742e97c9a58dcdbe82b6e78e54692e1b22b3ee0a","user":{"login":"cquiroz","id":3615303,"avatar_url":"https://avatars.githubusercontent.com/u/3615303?v=3","gravatar_id":"","url":"https://api.github.com/users/cquiroz","html_url":"https://github.com/cquiroz","followers_url":"https://api.github.com/users/cquiroz/followers","following_url":"https://api.github.com/users/cquiroz/following{/other_user}","gists_url":"https://api.github.com/users/cquiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/cquiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cquiroz/subscriptions","organizations_url":"https://api.github.com/users/cquiroz/orgs","repos_url":"https://api.github.com/users/cquiroz/repos","events_url":"https://api.github.com/users/cquiroz/events{/privacy}","received_events_url":"https://api.github.com/users/cquiroz/received_events","type":"User","site_admin":false},"repo":{"id":23979014,"name":"ocs","full_name":"cquiroz/ocs","owner":{"login":"cquiroz","id":3615303,"avatar_url":"https://avatars.githubusercontent.com/u/3615303?v=3","gravatar_id":"","url":"https://api.github.com/users/cquiroz","html_url":"https://github.com/cquiroz","followers_url":"https://api.github.com/users/cquiroz/followers","following_url":"https://api.github.com/users/cquiroz/following{/other_user}","gists_url":"https://api.github.com/users/cquiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/cquiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cquiroz/subscriptions","organizations_url":"https://api.github.com/users/cquiroz/orgs","repos_url":"https://api.github.com/users/cquiroz/repos","events_url":"https://api.github.com/users/cquiroz/events{/privacy}","received_events_url":"https://api.github.com/users/cquiroz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cquiroz/ocs","description":"","fork":true,"url":"https://api.github.com/repos/cquiroz/ocs","forks_url":"https://api.github.com/repos/cquiroz/ocs/forks","keys_url":"https://api.github.com/repos/cquiroz/ocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cquiroz/ocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cquiroz/ocs/teams","hooks_url":"https://api.github.com/repos/cquiroz/ocs/hooks","issue_events_url":"https://api.github.com/repos/cquiroz/ocs/issues/events{/number}","events_url":"https://api.github.com/repos/cquiroz/ocs/events","assignees_url":"https://api.github.com/repos/cquiroz/ocs/assignees{/user}","branches_url":"https://api.github.com/repos/cquiroz/ocs/branches{/branch}","tags_url":"https://api.github.com/repos/cquiroz/ocs/tags","blobs_url":"https://api.github.com/repos/cquiroz/ocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cquiroz/ocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cquiroz/ocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/cquiroz/ocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cquiroz/ocs/statuses/{sha}","languages_url":"https://api.github.com/repos/cquiroz/ocs/languages","stargazers_url":"https://api.github.com/repos/cquiroz/ocs/stargazers","contributors_url":"https://api.github.com/repos/cquiroz/ocs/contributors","subscribers_url":"https://api.github.com/repos/cquiroz/ocs/subscribers","subscription_url":"https://api.github.com/repos/cquiroz/ocs/subscription","commits_url":"https://api.github.com/repos/cquiroz/ocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/cquiroz/ocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/cquiroz/ocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/cquiroz/ocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/cquiroz/ocs/contents/{+path}","compare_url":"https://api.github.com/repos/cquiroz/ocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cquiroz/ocs/merges","archive_url":"https://api.github.com/repos/cquiroz/ocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cquiroz/ocs/downloads","issues_url":"https://api.github.com/repos/cquiroz/ocs/issues{/number}","pulls_url":"https://api.github.com/repos/cquiroz/ocs/pulls{/number}","milestones_url":"https://api.github.com/repos/cquiroz/ocs/milestones{/number}","notifications_url":"https://api.github.com/repos/cquiroz/ocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cquiroz/ocs/labels{/name}","releases_url":"https://api.github.com/repos/cquiroz/ocs/releases{/id}","created_at":"2014-09-12T22:30:57Z","updated_at":"2015-05-08T11:27:41Z","pushed_at":"2015-09-25T13:19:40Z","git_url":"git://github.com/cquiroz/ocs.git","ssh_url":"git@github.com:cquiroz/ocs.git","clone_url":"https://github.com/cquiroz/ocs.git","svn_url":"https://github.com/cquiroz/ocs","homepage":null,"size":269639,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"develop"}},"base":{"label":"gemini-hlsw:develop","ref":"develop","sha":"e5e9497b39cf7b96e4540c28e3d948dd8aa9b669","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":23963494,"name":"ocs","full_name":"gemini-hlsw/ocs","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/ocs","description":"Observatory Control Software","fork":false,"url":"https://api.github.com/repos/gemini-hlsw/ocs","forks_url":"https://api.github.com/repos/gemini-hlsw/ocs/forks","keys_url":"https://api.github.com/repos/gemini-hlsw/ocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gemini-hlsw/ocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gemini-hlsw/ocs/teams","hooks_url":"https://api.github.com/repos/gemini-hlsw/ocs/hooks","issue_events_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/events{/number}","events_url":"https://api.github.com/repos/gemini-hlsw/ocs/events","assignees_url":"https://api.github.com/repos/gemini-hlsw/ocs/assignees{/user}","branches_url":"https://api.github.com/repos/gemini-hlsw/ocs/branches{/branch}","tags_url":"https://api.github.com/repos/gemini-hlsw/ocs/tags","blobs_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/{sha}","languages_url":"https://api.github.com/repos/gemini-hlsw/ocs/languages","stargazers_url":"https://api.github.com/repos/gemini-hlsw/ocs/stargazers","contributors_url":"https://api.github.com/repos/gemini-hlsw/ocs/contributors","subscribers_url":"https://api.github.com/repos/gemini-hlsw/ocs/subscribers","subscription_url":"https://api.github.com/repos/gemini-hlsw/ocs/subscription","commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/gemini-hlsw/ocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/gemini-hlsw/ocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/gemini-hlsw/ocs/contents/{+path}","compare_url":"https://api.github.com/repos/gemini-hlsw/ocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gemini-hlsw/ocs/merges","archive_url":"https://api.github.com/repos/gemini-hlsw/ocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gemini-hlsw/ocs/downloads","issues_url":"https://api.github.com/repos/gemini-hlsw/ocs/issues{/number}","pulls_url":"https://api.github.com/repos/gemini-hlsw/ocs/pulls{/number}","milestones_url":"https://api.github.com/repos/gemini-hlsw/ocs/milestones{/number}","notifications_url":"https://api.github.com/repos/gemini-hlsw/ocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gemini-hlsw/ocs/labels{/name}","releases_url":"https://api.github.com/repos/gemini-hlsw/ocs/releases{/id}","created_at":"2014-09-12T14:20:23Z","updated_at":"2015-07-13T13:36:36Z","pushed_at":"2015-09-25T13:24:33Z","git_url":"git://github.com/gemini-hlsw/ocs.git","ssh_url":"git@github.com:gemini-hlsw/ocs.git","clone_url":"https://github.com/gemini-hlsw/ocs.git","svn_url":"https://github.com/gemini-hlsw/ocs","homepage":"","size":277622,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":5,"forks":13,"open_issues":5,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558"},"html":{"href":"https://github.com/gemini-hlsw/ocs/pull/558"},"issue":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/issues/558"},"comments":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/gemini-hlsw/ocs/statuses/742e97c9a58dcdbe82b6e78e54692e1b22b3ee0a"}}}}