{"action":"created","issue":{"url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/893","repository_url":"https://api.github.com/repos/open-source-economics/Tax-Calculator","labels_url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/893/labels{/name}","comments_url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/893/comments","events_url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/893/events","html_url":"https://github.com/open-source-economics/Tax-Calculator/pull/893","id":174449700,"number":893,"title":"add TaxForm and child classes to support Luca integration","user":{"login":"zrisher","id":1958130,"avatar_url":"https://avatars.githubusercontent.com/u/1958130?v=3","gravatar_id":"","url":"https://api.github.com/users/zrisher","html_url":"https://github.com/zrisher","followers_url":"https://api.github.com/users/zrisher/followers","following_url":"https://api.github.com/users/zrisher/following{/other_user}","gists_url":"https://api.github.com/users/zrisher/gists{/gist_id}","starred_url":"https://api.github.com/users/zrisher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zrisher/subscriptions","organizations_url":"https://api.github.com/users/zrisher/orgs","repos_url":"https://api.github.com/users/zrisher/repos","events_url":"https://api.github.com/users/zrisher/events{/privacy}","received_events_url":"https://api.github.com/users/zrisher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2016-09-01T06:54:27Z","updated_at":"2016-09-16T20:35:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/pulls/893","html_url":"https://github.com/open-source-economics/Tax-Calculator/pull/893","diff_url":"https://github.com/open-source-economics/Tax-Calculator/pull/893.diff","patch_url":"https://github.com/open-source-economics/Tax-Calculator/pull/893.patch"},"body":"This PR introduces the `TaxForm` base class and a child class for each tax form from which our input `evars` are derived. Please provide your feedback!\r\n\r\n**Purpose**\r\nThese classes are designed to help convert raw tax form field data into `evars` to support reading `luca` data (and eventually user-supplied tax form pdfs) as `taxcalc` input. \r\n\r\nEventually, they will also support converting `taxcalc` output to tax form data in `luca` and pdf format. They could also hold form-specific tax calculation logic, i.e. `taxcalc.functions.TaxGains()`, if deemed useful.\r\n\r\n**Status**\r\nThis is only part of the overall work I'm doing to support Luca input. However, it's the foundation for everything else and I believe it's ready for contributor suggestions and feedback (@martinholmer @talumbau @MattHJensen @feenberg @Amy-Xu @GoFroggyRun @codykallen). It's probably a little rough around the edges still, but it's complete with working tests and passes PEP8.\r\n\r\n**Effects on Taxcalc**\r\nThis does not touch `taxcalc` logic or even existing files besides including the new classes into the taxcalc module and a small helper function added to `utils.py`.\r\n\r\n**Notes on Architecture**\r\n\r\n**Class per form**\r\nIt seemed to me that one class per form made significantly more sense than one big mapping class for a few reasons:\r\n* The field to evar mappings are not always 1-1, can depend on the filing year, and take a fair number of lines (see `to_evars_direct()` and `to_evars_indirect()`).\r\n* Some forms have significantly less revisions than others and will be much easier to code mappings for. I wanted to easily indicate what years we were ready to work with (see `check_year_support`).\r\n* Some forms can be submitted multiple times for a single filing and computing their evars requires knowing about all the forms (e.g. P87482, E87487, E87492, E87497). Working with a collection of forms for a given filing will be handled by a `Filing` class to be introduced later (see https://github.com/zrisher/Tax-Calculator/commit/eb4a40b2c07fbd41599b48f7e01f36bcb35c4bb7). Converting to a `Record` set will then be handled by a `FilingCollection` (which can support multiple filings from multiple taxpayers).\r\n* Some tax forms have different fields for taxpayer id. \r\n* There's other logic we may want to segment per form in the future (e.g. pdf handling, form-specific calculations).\r\n* I'm a big fan of Domain Driven Design for maximizing maintainability and flexibility.\r\n\r\n**Field names**\r\nLuca provides user tax form data in JSON format with fields keys very similar to the format proposed here (the only differences are for some categorical things like filing status, where Luca has a variable similar to MARS but implemented differently). So passing data from Luca into these forms is nice and trivial, and can be handled by a `luca_io` class similar to `incometaxio` (see https://github.com/zrisher/Tax-Calculator/commit/eb4a40b2c07fbd41599b48f7e01f36bcb35c4bb7).   However, Luca cannot read from tax forms in pdf format, and its ability to write to them is limited to 2013 and earlier (2012 in some circumstances).\r\n\r\nThe field labels for IRS-provided PDFs are not particularly usable, so I believe Luca's \"line5a\" format that we've adopted is better. Here's a selection of the form metadata from the 1040 available [here](https://www.irs.gov/pub/irs-pdf/f1040.pdf) for lines 7-9b:\r\n\r\n```\r\n<IncomeSection xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" xfa:dataNode=\"dataGroup\"/>\r\n<f1_35/>\r\n<f1_36/>\r\n<f1_37/>\r\n<f1_38/>\r\n<f1_39/>\r\n<f1_40/>\r\n<f1_41/>\r\n<f1_42/>\r\n<f1_43/>\r\n<f1_44/>\r\n```\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/comments/247702877","html_url":"https://github.com/open-source-economics/Tax-Calculator/pull/893#issuecomment-247702877","issue_url":"https://api.github.com/repos/open-source-economics/Tax-Calculator/issues/893","id":247702877,"user":{"login":"MattHJensen","id":8301092,"avatar_url":"https://avatars.githubusercontent.com/u/8301092?v=3","gravatar_id":"","url":"https://api.github.com/users/MattHJensen","html_url":"https://github.com/MattHJensen","followers_url":"https://api.github.com/users/MattHJensen/followers","following_url":"https://api.github.com/users/MattHJensen/following{/other_user}","gists_url":"https://api.github.com/users/MattHJensen/gists{/gist_id}","starred_url":"https://api.github.com/users/MattHJensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MattHJensen/subscriptions","organizations_url":"https://api.github.com/users/MattHJensen/orgs","repos_url":"https://api.github.com/users/MattHJensen/repos","events_url":"https://api.github.com/users/MattHJensen/events{/privacy}","received_events_url":"https://api.github.com/users/MattHJensen/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T20:35:38Z","updated_at":"2016-09-16T20:35:38Z","body":"> Maybe the Luca-input scheme needs to be broadened beyond IRS forms to include something like the TurboTax Personal Information form. Does this make sense? Is there a better approach to gathering essential data that do not appear on IRS forms?\r\n\r\nThat makes sense to me, too. "}}
{"actor":{"display_login":"MattHJensen"}}