Get table keys for a single filing
get_keys.RdCollects the identifying metadata fields (OBJECTID, EIN, organization name, tax period, return type/flags, etc.) that key every relational table built from an IRS 990 e-file document. These are the "RDB keys" attached to every one-to-one and one-to-many table so that unique tax filings can be identified, filtered, and linked across tables.
Arguments
- doc
An XML document object (from
xml2::read_xml()).- url
Character. Source URL of the filing (stored as
URLand used to derive theOBJECTID).
Value
A named list of key fields for the filing, suitable for coercion to a one-row data frame:
- EIN2
Employer Identification Number formatted as
EIN-XX-XXXXXXX(seeformat_ein()).- OBJECTID
Unique filing identifier prefixed with
OID-, derived fromurl(seeget_object_id()).- ORG_EIN
Raw Employer Identification Number digits from the return header.
- ORG_NAME_L1
Filing organization name, line 1.
- ORG_NAME_L2
Filing organization name, line 2 (if present).
- RETURN_AMENDED_X
Logical;
TRUEif the filing is an amended return.- RETURN_GROUP_X
Logical;
TRUEif the filing is a group return for affiliates.- RETURN_PARTIAL_X
Logical;
TRUEif the tax period spans fewer than 360 days (partial-year return).- RETURN_TAXPER_DAYS
Number of days in the tax period (end minus begin, plus 1).
- RETURN_TIME_STAMP
Timestamp when the return was created/submitted.
- RETURN_TYPE
Return type (e.g.
"990","990EZ").- TAX_PERIOD_BEGIN_DATE
Tax period begin date.
- TAX_PERIOD_END_DATE
Tax period end date.
- TAX_YEAR
Tax year covered by the filing.
- URL
Source URL of the raw XML filing.
- VERSION
IRS schema version of the return (
returnVersionattribute).
See also
add_keys(), which attaches these keys to relational tables.
Examples
if (FALSE) { # \dontrun{
doc <- xml2::read_xml(url)
xml2::xml_ns_strip(doc)
get_keys(doc, url)
} # }