{"action":"created","comment":{"url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/comments/70504515","id":70504515,"diff_hunk":"@@ -83,63 +87,67 @@ object LarCsvParser {\n         )\n       val denial = Denial(denial1, denial2, denial3)\n \n-      Right(LoanApplicationRegister(\n-        id,\n-        respId,\n-        agencyCode,\n-        loan,\n-        preapprovals,\n-        actionType,\n-        actionDate,\n-        geography,\n-        applicant,\n-        purchaserType,\n-        denial,\n-        rateSpread,\n-        hoepaStatus,\n-        lienStatus\n-      ))\n+      Right(\n+        LoanApplicationRegister(\n+          id,\n+          respId,\n+          agencyCode,\n+          loan,\n+          preapprovals,\n+          actionType,\n+          actionDate,\n+          geography,\n+          applicant,\n+          purchaserType,\n+          denial,\n+          rateSpread,\n+          hoepaStatus,\n+          lienStatus\n+        )\n+      )\n     } else {\n-      Left(larErrors)\n+      val lErrors = validation.toEither.left.get\n+      Left(lErrors.list.toList)\n     }\n   }\n \n-  def checkLar(s: String): List[String] = {\n-    val values = s.split('|').map(_.trim)\n-    var errors = List[String]()\n-    val numericFields = Map(\n-      0 -> \"Record Identifier\",\n-      2 -> \"Agency Code\",\n-      5 -> \"Loan Type\",\n-      6 -> \"Property Type\",\n-      7 -> \"Loan Purpose\",\n-      8 -> \"Owner Occupancy\",\n-      9 -> \"Loan Amount\",\n-      10 -> \"Preapprovals\",\n-      11 -> \"Type of Action Taken\",\n-      12 -> \"Date of Action\",\n-      17 -> \"Applicant Ethnicity\",\n-      18 -> \"Co-applicant Ethnicity\",\n-      19 -> \"Applicant Race: 1\",\n-      24 -> \"Co-applicant Race: 1\",\n-      29 -> \"Applicant Sex\",\n-      30 -> \"Co-applicant Sex\",\n-      32 -> \"Type of Purchaser\",\n-      37 -> \"HOEPA Status\",\n-      38 -> \"Lien Status\"\n-    )\n-\n-    if (values.length != 40 && values.length != 39) {\n-      return errors ::: List(\"Incorrect number of fields: \" + values.length)\n+  def toIntorFail(value: String, fieldName: String): ValidationNel[String, List[Int]] = {\n+    Try(value.toInt) match {\n+      case Failure(result) => s\"$fieldName is not an Integer\".failure.toValidationNel\n+      case Success(result) => List(result).success","path":"parser/src/main/scala/hmda/parser/fi/lar/LarCsvParser.scala","position":157,"original_position":157,"commit_id":"b5b997728cbce83428d6a733300e854cf6b71381","original_commit_id":"b5b997728cbce83428d6a733300e854cf6b71381","user":{"login":"nickgrippin","id":19194939,"avatar_url":"https://avatars.githubusercontent.com/u/19194939?v=3","gravatar_id":"","url":"https://api.github.com/users/nickgrippin","html_url":"https://github.com/nickgrippin","followers_url":"https://api.github.com/users/nickgrippin/followers","following_url":"https://api.github.com/users/nickgrippin/following{/other_user}","gists_url":"https://api.github.com/users/nickgrippin/gists{/gist_id}","starred_url":"https://api.github.com/users/nickgrippin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickgrippin/subscriptions","organizations_url":"https://api.github.com/users/nickgrippin/orgs","repos_url":"https://api.github.com/users/nickgrippin/repos","events_url":"https://api.github.com/users/nickgrippin/events{/privacy}","received_events_url":"https://api.github.com/users/nickgrippin/received_events","type":"User","site_admin":false},"body":"Creating a wrapper object around a single `Int` seems like overkill, but I understand the need to not have the aggregation simply sum all the values.  Maybe there's a different way to aggregate these values without a need for a wrapper?","created_at":"2016-07-12T19:22:25Z","updated_at":"2016-07-12T19:22:25Z","html_url":"https://github.com/nickgrippin/hmda-platform/pull/1#discussion_r70504515","pull_request_url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/comments/70504515"},"html":{"href":"https://github.com/nickgrippin/hmda-platform/pull/1#discussion_r70504515"},"pull_request":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1","id":77172097,"html_url":"https://github.com/nickgrippin/hmda-platform/pull/1","diff_url":"https://github.com/nickgrippin/hmda-platform/pull/1.diff","patch_url":"https://github.com/nickgrippin/hmda-platform/pull/1.patch","issue_url":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/1","number":1,"state":"open","locked":false,"title":"make finding parser errors more functional","user":{"login":"kgudel","id":13244336,"avatar_url":"https://avatars.githubusercontent.com/u/13244336?v=3","gravatar_id":"","url":"https://api.github.com/users/kgudel","html_url":"https://github.com/kgudel","followers_url":"https://api.github.com/users/kgudel/followers","following_url":"https://api.github.com/users/kgudel/following{/other_user}","gists_url":"https://api.github.com/users/kgudel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgudel/subscriptions","organizations_url":"https://api.github.com/users/kgudel/orgs","repos_url":"https://api.github.com/users/kgudel/repos","events_url":"https://api.github.com/users/kgudel/events{/privacy}","received_events_url":"https://api.github.com/users/kgudel/received_events","type":"User","site_admin":false},"body":"My thought for this pr was two fold: The first was to find a way to make finding errors more function by using scalaz and the second was to find a way to check that a value could be converted into an int and convert it at the same time.","created_at":"2016-07-12T18:56:25Z","updated_at":"2016-07-12T19:22:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62e910e57a9586789ad293b7209850fd42e72cdf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1/commits","review_comments_url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1/comments","review_comment_url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/1/comments","statuses_url":"https://api.github.com/repos/nickgrippin/hmda-platform/statuses/b5b997728cbce83428d6a733300e854cf6b71381","head":{"label":"kgudel:parserErrorsOne","ref":"parserErrorsOne","sha":"b5b997728cbce83428d6a733300e854cf6b71381","user":{"login":"kgudel","id":13244336,"avatar_url":"https://avatars.githubusercontent.com/u/13244336?v=3","gravatar_id":"","url":"https://api.github.com/users/kgudel","html_url":"https://github.com/kgudel","followers_url":"https://api.github.com/users/kgudel/followers","following_url":"https://api.github.com/users/kgudel/following{/other_user}","gists_url":"https://api.github.com/users/kgudel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgudel/subscriptions","organizations_url":"https://api.github.com/users/kgudel/orgs","repos_url":"https://api.github.com/users/kgudel/repos","events_url":"https://api.github.com/users/kgudel/events{/privacy}","received_events_url":"https://api.github.com/users/kgudel/received_events","type":"User","site_admin":false},"repo":{"id":57915203,"name":"hmda-platform","full_name":"kgudel/hmda-platform","owner":{"login":"kgudel","id":13244336,"avatar_url":"https://avatars.githubusercontent.com/u/13244336?v=3","gravatar_id":"","url":"https://api.github.com/users/kgudel","html_url":"https://github.com/kgudel","followers_url":"https://api.github.com/users/kgudel/followers","following_url":"https://api.github.com/users/kgudel/following{/other_user}","gists_url":"https://api.github.com/users/kgudel/gists{/gist_id}","starred_url":"https://api.github.com/users/kgudel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgudel/subscriptions","organizations_url":"https://api.github.com/users/kgudel/orgs","repos_url":"https://api.github.com/users/kgudel/repos","events_url":"https://api.github.com/users/kgudel/events{/privacy}","received_events_url":"https://api.github.com/users/kgudel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kgudel/hmda-platform","description":"","fork":true,"url":"https://api.github.com/repos/kgudel/hmda-platform","forks_url":"https://api.github.com/repos/kgudel/hmda-platform/forks","keys_url":"https://api.github.com/repos/kgudel/hmda-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kgudel/hmda-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kgudel/hmda-platform/teams","hooks_url":"https://api.github.com/repos/kgudel/hmda-platform/hooks","issue_events_url":"https://api.github.com/repos/kgudel/hmda-platform/issues/events{/number}","events_url":"https://api.github.com/repos/kgudel/hmda-platform/events","assignees_url":"https://api.github.com/repos/kgudel/hmda-platform/assignees{/user}","branches_url":"https://api.github.com/repos/kgudel/hmda-platform/branches{/branch}","tags_url":"https://api.github.com/repos/kgudel/hmda-platform/tags","blobs_url":"https://api.github.com/repos/kgudel/hmda-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kgudel/hmda-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kgudel/hmda-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/kgudel/hmda-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kgudel/hmda-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/kgudel/hmda-platform/languages","stargazers_url":"https://api.github.com/repos/kgudel/hmda-platform/stargazers","contributors_url":"https://api.github.com/repos/kgudel/hmda-platform/contributors","subscribers_url":"https://api.github.com/repos/kgudel/hmda-platform/subscribers","subscription_url":"https://api.github.com/repos/kgudel/hmda-platform/subscription","commits_url":"https://api.github.com/repos/kgudel/hmda-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/kgudel/hmda-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/kgudel/hmda-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/kgudel/hmda-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/kgudel/hmda-platform/contents/{+path}","compare_url":"https://api.github.com/repos/kgudel/hmda-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kgudel/hmda-platform/merges","archive_url":"https://api.github.com/repos/kgudel/hmda-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kgudel/hmda-platform/downloads","issues_url":"https://api.github.com/repos/kgudel/hmda-platform/issues{/number}","pulls_url":"https://api.github.com/repos/kgudel/hmda-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/kgudel/hmda-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/kgudel/hmda-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kgudel/hmda-platform/labels{/name}","releases_url":"https://api.github.com/repos/kgudel/hmda-platform/releases{/id}","deployments_url":"https://api.github.com/repos/kgudel/hmda-platform/deployments","created_at":"2016-05-02T19:22:32Z","updated_at":"2016-05-02T19:22:35Z","pushed_at":"2016-07-12T18:55:57Z","git_url":"git://github.com/kgudel/hmda-platform.git","ssh_url":"git@github.com:kgudel/hmda-platform.git","clone_url":"https://github.com/kgudel/hmda-platform.git","svn_url":"https://github.com/kgudel/hmda-platform","homepage":"","size":4266,"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":"nickgrippin:return-parser-errors","ref":"return-parser-errors","sha":"7d4ade0bed64ad2730fb7d0542d6be09afed4d00","user":{"login":"nickgrippin","id":19194939,"avatar_url":"https://avatars.githubusercontent.com/u/19194939?v=3","gravatar_id":"","url":"https://api.github.com/users/nickgrippin","html_url":"https://github.com/nickgrippin","followers_url":"https://api.github.com/users/nickgrippin/followers","following_url":"https://api.github.com/users/nickgrippin/following{/other_user}","gists_url":"https://api.github.com/users/nickgrippin/gists{/gist_id}","starred_url":"https://api.github.com/users/nickgrippin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickgrippin/subscriptions","organizations_url":"https://api.github.com/users/nickgrippin/orgs","repos_url":"https://api.github.com/users/nickgrippin/repos","events_url":"https://api.github.com/users/nickgrippin/events{/privacy}","received_events_url":"https://api.github.com/users/nickgrippin/received_events","type":"User","site_admin":false},"repo":{"id":58931407,"name":"hmda-platform","full_name":"nickgrippin/hmda-platform","owner":{"login":"nickgrippin","id":19194939,"avatar_url":"https://avatars.githubusercontent.com/u/19194939?v=3","gravatar_id":"","url":"https://api.github.com/users/nickgrippin","html_url":"https://github.com/nickgrippin","followers_url":"https://api.github.com/users/nickgrippin/followers","following_url":"https://api.github.com/users/nickgrippin/following{/other_user}","gists_url":"https://api.github.com/users/nickgrippin/gists{/gist_id}","starred_url":"https://api.github.com/users/nickgrippin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickgrippin/subscriptions","organizations_url":"https://api.github.com/users/nickgrippin/orgs","repos_url":"https://api.github.com/users/nickgrippin/repos","events_url":"https://api.github.com/users/nickgrippin/events{/privacy}","received_events_url":"https://api.github.com/users/nickgrippin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nickgrippin/hmda-platform","description":"","fork":true,"url":"https://api.github.com/repos/nickgrippin/hmda-platform","forks_url":"https://api.github.com/repos/nickgrippin/hmda-platform/forks","keys_url":"https://api.github.com/repos/nickgrippin/hmda-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nickgrippin/hmda-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nickgrippin/hmda-platform/teams","hooks_url":"https://api.github.com/repos/nickgrippin/hmda-platform/hooks","issue_events_url":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/events{/number}","events_url":"https://api.github.com/repos/nickgrippin/hmda-platform/events","assignees_url":"https://api.github.com/repos/nickgrippin/hmda-platform/assignees{/user}","branches_url":"https://api.github.com/repos/nickgrippin/hmda-platform/branches{/branch}","tags_url":"https://api.github.com/repos/nickgrippin/hmda-platform/tags","blobs_url":"https://api.github.com/repos/nickgrippin/hmda-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nickgrippin/hmda-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nickgrippin/hmda-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/nickgrippin/hmda-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nickgrippin/hmda-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/nickgrippin/hmda-platform/languages","stargazers_url":"https://api.github.com/repos/nickgrippin/hmda-platform/stargazers","contributors_url":"https://api.github.com/repos/nickgrippin/hmda-platform/contributors","subscribers_url":"https://api.github.com/repos/nickgrippin/hmda-platform/subscribers","subscription_url":"https://api.github.com/repos/nickgrippin/hmda-platform/subscription","commits_url":"https://api.github.com/repos/nickgrippin/hmda-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/nickgrippin/hmda-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/nickgrippin/hmda-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/nickgrippin/hmda-platform/contents/{+path}","compare_url":"https://api.github.com/repos/nickgrippin/hmda-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nickgrippin/hmda-platform/merges","archive_url":"https://api.github.com/repos/nickgrippin/hmda-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nickgrippin/hmda-platform/downloads","issues_url":"https://api.github.com/repos/nickgrippin/hmda-platform/issues{/number}","pulls_url":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/nickgrippin/hmda-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/nickgrippin/hmda-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nickgrippin/hmda-platform/labels{/name}","releases_url":"https://api.github.com/repos/nickgrippin/hmda-platform/releases{/id}","deployments_url":"https://api.github.com/repos/nickgrippin/hmda-platform/deployments","created_at":"2016-05-16T12:40:57Z","updated_at":"2016-05-16T12:41:00Z","pushed_at":"2016-07-12T18:56:25Z","git_url":"git://github.com/nickgrippin/hmda-platform.git","ssh_url":"git@github.com:nickgrippin/hmda-platform.git","clone_url":"https://github.com/nickgrippin/hmda-platform.git","svn_url":"https://github.com/nickgrippin/hmda-platform","homepage":"","size":4345,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1"},"html":{"href":"https://github.com/nickgrippin/hmda-platform/pull/1"},"issue":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/1"},"comments":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/nickgrippin/hmda-platform/statuses/b5b997728cbce83428d6a733300e854cf6b71381"}}}}
{"actor":{"display_login":"nickgrippin"}}