Setup

Load Packages

library( irs990efile )  # functions for parsing efile XMLs
library( dplyr )        # data wrangling
library( purrr )        # data wrangling 
library( pander )       # formatting
library( knitr )        # formatting
library( DT )           # table printing
library( httr )         # web requests 
library( xmltools )     # xml utilities
library( xml2 )         # xml utilities
library( XML )          # xml utilities 
library( data.tree )    # network visualization
library( networkD3 )    # network visualization
library( igraph )       # network visualization

source( "R/rdb-functions-v2.R")
source( "R/utils.R")

Data

head( index )

The Concordance File

The concordance is an RDB to XML Crosswalk that maps all xpaths onto a specified set of variables. It is located in the irs990efile package.


The full data dictionary is available on GitHub.

DATA DICTIONARY


concordance %>% 
  filter( rdb_table == table.name )  








xpath id
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AdequateBooksAndRecdsMaintaind 1
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AdvanceRefunding 2
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountBondDefeased 3
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountDefeased 4
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountInReserveFund 5
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountRetired 6
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountUnspent 7
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/BondReferenceCd 8
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CapitalExpenditures 9
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CapitalizedInterest 10
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CreditEnhancement 11
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CurrentRefunding 12
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/FinalAllocationMade 13
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/IssuanceCostsFromProceeds 14
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/OtherSpentProceeds 15
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/RefundingEscrow 16
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/TotalProceeds 17
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/WorkingCapitalExpenditures 18
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/YearOfSubstCompletion 19
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/AdequateBooksAndRecMaintInd 20
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/AdvanceRefundingInd 21
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/BondDefeasedAmt 22
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/BondReferenceCd 23
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CapitalExpendituresAmt 24
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CapitalizedInterestAmt 25
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CreditEnhancementAmt 26
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CurrentRefundingInd 27
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/FinalAllocationMadeInd 28
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/InReserveFundAmt 29
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/IssuanceCostsFromProceedsAmt 30
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/OtherSpentProceedsAmt 31
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/RefundingEscrowAmt 32
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/RetiredAmt 33
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/SubstantialCompletionYr 34
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/TotalProceedsAmt 35
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/UnspentAmt 36
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/WorkingCapitalExpendituresAmt 37
xpaths <- as.character( t.xpaths$xpath )
el <- create_edgelist_v1( xpaths )
nd <- FromDataFrameNetwork( network=el )
print( nd )
##                                         levelName
## 1  Return                                        
## 2   °--ReturnData                                
## 3       °--IRS990ScheduleK                       
## 4           ¦--Form990ScheduleKPartII            
## 5           ¦   ¦--AdequateBooksAndRecdsMaintaind
## 6           ¦   ¦--AdvanceRefunding              
## 7           ¦   ¦--AmountBondDefeased            
## 8           ¦   ¦--AmountDefeased                
## 9           ¦   ¦--AmountInReserveFund           
## 10          ¦   ¦--AmountRetired                 
## 11          ¦   ¦--AmountUnspent                 
## 12          ¦   ¦--BondReferenceCd               
## 13          ¦   ¦--CapitalExpenditures           
## 14          ¦   ¦--CapitalizedInterest           
## 15          ¦   ¦--CreditEnhancement             
## 16          ¦   ¦--CurrentRefunding              
## 17          ¦   ¦--FinalAllocationMade           
## 18          ¦   ¦--IssuanceCostsFromProceeds     
## 19          ¦   ¦--OtherSpentProceeds            
## 20          ¦   ¦--RefundingEscrow               
## 21          ¦   ¦--TotalProceeds                 
## 22          ¦   ¦--WorkingCapitalExpenditures    
## 23          ¦   °--YearOfSubstCompletion         
## 24          °--TaxExemptBondsProceedsGrp         
## 25              ¦--AdequateBooksAndRecMaintInd   
## 26              ¦--AdvanceRefundingInd           
## 27              ¦--BondDefeasedAmt               
## 28              ¦--BondReferenceCd               
## 29              ¦--CapitalExpendituresAmt        
## 30              ¦--CapitalizedInterestAmt        
## 31              ¦--CreditEnhancementAmt          
## 32              ¦--CurrentRefundingInd           
## 33              ¦--FinalAllocationMadeInd        
## 34              ¦--InReserveFundAmt              
## 35              ¦--IssuanceCostsFromProceedsAmt  
## 36              ¦--OtherSpentProceedsAmt         
## 37              ¦--RefundingEscrowAmt            
## 38              ¦--RetiredAmt                    
## 39              ¦--SubstantialCompletionYr       
## 40              ¦--TotalProceedsAmt              
## 41              ¦--UnspentAmt                    
## 42              °--WorkingCapitalExpendituresAmt
SetGraphStyle( nd, rankdir = "LR")
SetEdgeStyle( nd, arrowhead = "vee", color = "grey20", penwidth = 2 )
SetNodeStyle( nd, 
              style = "filled,rounded", 
              shape = "box", 
              fillcolor = "LightBlue", 
              fontname = "helvetica", 
              fontcolor="black",
              tooltip = GetDefaultTooltip )

# SetNodeStyle(acme$IT, fillcolor = "LightBlue", penwidth = "5px")
plot( nd )
# old version
find_group_names( table.name )
## [1] "//Form990ScheduleKPartII"    "//TaxExemptBondsProceedsGrp"
# new version
find_table_headers( table.name )
##  [1] "//Form990ScheduleKPartII/BondReferenceCd"                 
##  [2] "//Form990ScheduleKPartII/AmountRetired"                   
##  [3] "//Form990ScheduleKPartII/AmountBondDefeased"              
##  [4] "//Form990ScheduleKPartII/AmountDefeased"                  
##  [5] "//Form990ScheduleKPartII/TotalProceeds"                   
##  [6] "//Form990ScheduleKPartII/AmountInReserveFund"             
##  [7] "//Form990ScheduleKPartII/CapitalizedInterest"             
##  [8] "//Form990ScheduleKPartII/RefundingEscrow"                 
##  [9] "//Form990ScheduleKPartII/IssuanceCostsFromProceeds"       
## [10] "//Form990ScheduleKPartII/CreditEnhancement"               
## [11] "//Form990ScheduleKPartII/WorkingCapitalExpenditures"      
## [12] "//Form990ScheduleKPartII/CapitalExpenditures"             
## [13] "//Form990ScheduleKPartII/OtherSpentProceeds"              
## [14] "//Form990ScheduleKPartII/AmountUnspent"                   
## [15] "//Form990ScheduleKPartII/YearOfSubstCompletion"           
## [16] "//Form990ScheduleKPartII/CurrentRefunding"                
## [17] "//Form990ScheduleKPartII/AdvanceRefunding"                
## [18] "//Form990ScheduleKPartII/FinalAllocationMade"             
## [19] "//Form990ScheduleKPartII/AdequateBooksAndRecdsMaintaind"  
## [20] "//TaxExemptBondsProceedsGrp/BondReferenceCd"              
## [21] "//TaxExemptBondsProceedsGrp/RetiredAmt"                   
## [22] "//TaxExemptBondsProceedsGrp/BondDefeasedAmt"              
## [23] "//TaxExemptBondsProceedsGrp/TotalProceedsAmt"             
## [24] "//TaxExemptBondsProceedsGrp/InReserveFundAmt"             
## [25] "//TaxExemptBondsProceedsGrp/CapitalizedInterestAmt"       
## [26] "//TaxExemptBondsProceedsGrp/RefundingEscrowAmt"           
## [27] "//TaxExemptBondsProceedsGrp/IssuanceCostsFromProceedsAmt" 
## [28] "//TaxExemptBondsProceedsGrp/CreditEnhancementAmt"         
## [29] "//TaxExemptBondsProceedsGrp/WorkingCapitalExpendituresAmt"
## [30] "//TaxExemptBondsProceedsGrp/CapitalExpendituresAmt"       
## [31] "//TaxExemptBondsProceedsGrp/OtherSpentProceedsAmt"        
## [32] "//TaxExemptBondsProceedsGrp/UnspentAmt"                   
## [33] "//TaxExemptBondsProceedsGrp/SubstantialCompletionYr"      
## [34] "//TaxExemptBondsProceedsGrp/CurrentRefundingInd"          
## [35] "//TaxExemptBondsProceedsGrp/AdvanceRefundingInd"          
## [36] "//TaxExemptBondsProceedsGrp/FinalAllocationMadeInd"       
## [37] "//TaxExemptBondsProceedsGrp/AdequateBooksAndRecMaintInd"
# manual
if( ! is.null(table.headers) )
{table.headers}








Build the Table

# create new folder
dir.create( folder.name )
setwd( folder.name )

# create sample
set.seed( 1234 )
sample.index <- sample_n( index, sample.size )
write.csv( index, "sample-index.csv", row.names=F )
sample.urls <- sample.index$URL

# erase existing log files
file.create("XPATH-LOG.txt") 
file.create("FAIL-LOG.txt")


start.build.time <- Sys.time()    # --------------------

results.list <- list()
xpath.list <- list()


for( i in 1:length( sample.urls ) )
{
  
  url <- sample.urls[i]
  
  results.list[[i]] <- 
    build_rdb_table_v2( url, 
                        table.name, 
                        table.headers=table.headers )
  
  xpath.list[[i]]   <- 
    get_table_xpaths( url, 
                      table.name, 
                      table.headers=table.headers )
  
  if( i %% 100 == 0 ){ print(i) }
  
}


end.build.time <- Sys.time()      # --------------------


df <- dplyr::bind_rows( results.list )


fail.log <- readLines( "FAIL-LOG.txt" )
all.xpaths <- xpath.list %>% unlist() %>% unique() %>% sort()
cat( all.xpaths, sep="\n", file="XPATH-LOG.txt" )

TABLE: SK-P02-T01-BOND-PROCEEDS

## [1] "NUMBER OF RETURNS PROCESSED:   1000"
## [1] "TOTAL NUMBER OF TABLE ROWS:   2064"

TOTAL RUN TIME:

## Time difference of 13.33343 hours
## Time difference of -13.33343 hours

Write to File

write.csv( df, paste0( folder.name, "/", table.name, ".csv" ), row.names=F )
head(df) 

Are all names standardized?

names(df)
##  [1] "OBJECT_ID"                        "EIN"                             
##  [3] "NAME"                             "TAXYR"                           
##  [5] "FORMTYPE"                         "URL"                             
##  [7] "SK_02_BOND_ISSUE_REFERENCE_NUM"   "SK_02_BOND_PROCEED_AMT_RETIRED"  
##  [9] "SK_02_BOND_PROCEED_AMT_DEFEASED"  "SK_02_BOND_PROCEED_TOT"          
## [11] "SK_02_BOND_PROCEED_RESERVE_FUND"  "SK_02_BOND_PROCEED_INT_CAP"      
## [13] "SK_02_BOND_PROCEED_REFUND_ESCROW" "SK_02_BOND_PROCEED_ISSUANCE_COST"
## [15] "SK_02_BOND_PROCEED_CREDIT_ENHANC" "SK_02_BOND_PROCEED_CAP_EXP_WORK" 
## [17] "SK_02_BOND_PROCEED_CAP_EXP"       "SK_02_BOND_PROCEED_OTH_SPENT"    
## [19] "SK_02_BOND_PROCEED_OTH_UNSPENT"   "SK_02_BOND_PROCEED_Y_COMPLETION."
## [21] "RefundingTaxExemptBondsInd"       "RefundingTaxableBondsInd"        
## [23] "SK_02_BOND_PROCEED_ALLOC_FINAL_X" "SK_02_BOND_PROCEED_BOOK_RECORD_X"








Diagnostics

Missing or Extra XPATHS

Check for xpaths that were used in the tables but do not exist in the Concordance file.

c.table <- dplyr::filter( concordance, rdb_table == table.name ) 
xpath.concordance <- c.table$xpath
setdiff( all.xpaths, xpath.concordance )
## [1] ""

Capture to update the Concordance file.

these <- setdiff( all.xpaths, xpath.concordance )
cat( these, sep="\n", file=paste0( folder.name, "/MISSING-XPATHS.txt" ) )

Failes URLs

Check the status of failed URLs.

if( length(fail.log) > 0 )
{ 
  sapply( fail.log, get_message ) %>% 
  table() %>% 
  pander() 
} else {
  print("ALL URLs ARE VALID")
}
## [1] "ALL URLs ARE VALID"








XML Table Structure

Create Network Edgelists

The create_edgelist() functions v1 and v2 are in R/utils.R.

V1 retains the root nodes Return and ReturnData.

V2 drops the root nodes and uses form versions “990” and “990EZ” as the root to visualize the sets of tables separately.

# KEEP ROOT NOTES Return & ReturnData
el <- create_edgelist_v1( all.xpaths )



Edgelist format:

V1 V2
Return ReturnData
ReturnData IRS990
IRS990 Form990PartVIISectionAGrp
Form990PartVIISectionAGrp PersonNm
Form990PartVIISectionAGrp TitleTxt
Form990PartVIISectionAGrp AverageHoursPerWeekRt
Form990PartVIISectionAGrp IndividualTrusteeOrDirectorInd
Form990PartVIISectionAGrp OfficerInd
Form990PartVIISectionAGrp ReportableCompFromOrgAmt
Form990PartVIISectionAGrp ReportableCompFromRltdOrgAmt








Visualize Tree Structure

# library( data.tree )
nd <- FromDataFrameNetwork( network=el )
print( nd )
##                                        levelName
## 1  Return                                       
## 2   °--ReturnData                               
## 3       °--IRS990ScheduleK                      
## 4           °--TaxExemptBondsProceedsGrp        
## 5               ¦--AdequateBooksAndRecMaintInd  
## 6               ¦--BondDefeasedAmt              
## 7               ¦--BondReferenceCd              
## 8               ¦--CapitalExpendituresAmt       
## 9               ¦--CapitalizedInterestAmt       
## 10              ¦--CreditEnhancementAmt         
## 11              ¦--FinalAllocationMadeInd       
## 12              ¦--InReserveFundAmt             
## 13              ¦--IssuanceCostsFromProceedsAmt 
## 14              ¦--OtherSpentProceedsAmt        
## 15              ¦--RefundingEscrowAmt           
## 16              ¦--RetiredAmt                   
## 17              ¦--SubstantialCompletionYr      
## 18              ¦--TotalProceedsAmt             
## 19              ¦--UnspentAmt                   
## 20              °--WorkingCapitalExpendituresAmt
SetGraphStyle( nd, rankdir = "LR")
SetEdgeStyle( nd, arrowhead = "vee", color = "grey20", penwidth = 2 )
SetNodeStyle( nd, 
              style = "filled,rounded", 
              shape = "box", 
              fillcolor = "LightBlue", 
              fontname = "helvetica", 
              fontcolor="black",
              tooltip = GetDefaultTooltip )

# SetNodeStyle(acme$IT, fillcolor = "LightBlue", penwidth = "5px")
plot( nd )
# library( networkD3 )
# net <- ToDataFrameNetwork( nd, "name" )
# simpleNetwork( net, fontSize = 12 )
simpleNetwork( el, fontSize = 12 )
#plot with networkD3
radnet <- ToListExplicit( nd, unname = TRUE )
radialNetwork( radnet, fontSize = 12 )








XPATH Summary

Unique Xpaths for this RDB Table

t.xpaths <- 
  concordance %>%
  filter( rdb_table == table.name ) %>% 
  select( xpath ) %>% 
  unique() %>% 
  arrange( xpath ) %>% 
  mutate( id=row_number() ) 

t.xpaths %>% 
  kable( align="l" )
xpath id
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AdequateBooksAndRecdsMaintaind 1
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AdvanceRefunding 2
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountBondDefeased 3
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountDefeased 4
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountInReserveFund 5
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountRetired 6
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/AmountUnspent 7
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/BondReferenceCd 8
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CapitalExpenditures 9
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CapitalizedInterest 10
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CreditEnhancement 11
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/CurrentRefunding 12
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/FinalAllocationMade 13
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/IssuanceCostsFromProceeds 14
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/OtherSpentProceeds 15
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/RefundingEscrow 16
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/TotalProceeds 17
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/WorkingCapitalExpenditures 18
/Return/ReturnData/IRS990ScheduleK/Form990ScheduleKPartII/YearOfSubstCompletion 19
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/AdequateBooksAndRecMaintInd 20
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/AdvanceRefundingInd 21
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/BondDefeasedAmt 22
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/BondReferenceCd 23
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CapitalExpendituresAmt 24
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CapitalizedInterestAmt 25
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CreditEnhancementAmt 26
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/CurrentRefundingInd 27
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/FinalAllocationMadeInd 28
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/InReserveFundAmt 29
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/IssuanceCostsFromProceedsAmt 30
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/OtherSpentProceedsAmt 31
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/RefundingEscrowAmt 32
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/RetiredAmt 33
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/SubstantialCompletionYr 34
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/TotalProceedsAmt 35
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/UnspentAmt 36
/Return/ReturnData/IRS990ScheduleK/TaxExemptBondsProceedsGrp/WorkingCapitalExpendituresAmt 37

Grouping Variables

Identify all unique groups used in xpaths.

if( is.null(table.headers) )
{ find_table_headers( table.name ) } else
table.headers
##  [1] "//Form990ScheduleKPartII/BondReferenceCd"                 
##  [2] "//Form990ScheduleKPartII/AmountRetired"                   
##  [3] "//Form990ScheduleKPartII/AmountBondDefeased"              
##  [4] "//Form990ScheduleKPartII/AmountDefeased"                  
##  [5] "//Form990ScheduleKPartII/TotalProceeds"                   
##  [6] "//Form990ScheduleKPartII/AmountInReserveFund"             
##  [7] "//Form990ScheduleKPartII/CapitalizedInterest"             
##  [8] "//Form990ScheduleKPartII/RefundingEscrow"                 
##  [9] "//Form990ScheduleKPartII/IssuanceCostsFromProceeds"       
## [10] "//Form990ScheduleKPartII/CreditEnhancement"               
## [11] "//Form990ScheduleKPartII/WorkingCapitalExpenditures"      
## [12] "//Form990ScheduleKPartII/CapitalExpenditures"             
## [13] "//Form990ScheduleKPartII/OtherSpentProceeds"              
## [14] "//Form990ScheduleKPartII/AmountUnspent"                   
## [15] "//Form990ScheduleKPartII/YearOfSubstCompletion"           
## [16] "//Form990ScheduleKPartII/CurrentRefunding"                
## [17] "//Form990ScheduleKPartII/AdvanceRefunding"                
## [18] "//Form990ScheduleKPartII/FinalAllocationMade"             
## [19] "//Form990ScheduleKPartII/AdequateBooksAndRecdsMaintaind"  
## [20] "//TaxExemptBondsProceedsGrp/BondReferenceCd"              
## [21] "//TaxExemptBondsProceedsGrp/RetiredAmt"                   
## [22] "//TaxExemptBondsProceedsGrp/BondDefeasedAmt"              
## [23] "//TaxExemptBondsProceedsGrp/TotalProceedsAmt"             
## [24] "//TaxExemptBondsProceedsGrp/InReserveFundAmt"             
## [25] "//TaxExemptBondsProceedsGrp/CapitalizedInterestAmt"       
## [26] "//TaxExemptBondsProceedsGrp/RefundingEscrowAmt"           
## [27] "//TaxExemptBondsProceedsGrp/IssuanceCostsFromProceedsAmt" 
## [28] "//TaxExemptBondsProceedsGrp/CreditEnhancementAmt"         
## [29] "//TaxExemptBondsProceedsGrp/WorkingCapitalExpendituresAmt"
## [30] "//TaxExemptBondsProceedsGrp/CapitalExpendituresAmt"       
## [31] "//TaxExemptBondsProceedsGrp/OtherSpentProceedsAmt"        
## [32] "//TaxExemptBondsProceedsGrp/UnspentAmt"                   
## [33] "//TaxExemptBondsProceedsGrp/SubstantialCompletionYr"      
## [34] "//TaxExemptBondsProceedsGrp/CurrentRefundingInd"          
## [35] "//TaxExemptBondsProceedsGrp/AdvanceRefundingInd"          
## [36] "//TaxExemptBondsProceedsGrp/FinalAllocationMadeInd"       
## [37] "//TaxExemptBondsProceedsGrp/AdequateBooksAndRecMaintInd"

Groups can then be used to extract the 1:M RDB tables:

if( is.null(table.headers) )
{ table.headers <- find_table_headers( table.name ) }
demo.url <- "https://nccs-efile.s3.us-east-1.amazonaws.com/xml/201913079349300206_public.xml"
doc <- xml2::read_xml( demo.url )
xml2::xml_ns_strip( doc )
df.demo <- get_table_v2( doc, table.name, table.headers )
df.demo 
## NULL

Standardize Variable Names

Mapping of xml variable names to concordance variable names:

get_var_map( table.name=table.name )

A table with proper names:

v.map <- get_var_map( table.name=table.name )

if( ! is.null(df.demo) )
{re_name( df.demo, v.map ) %>% as.data.frame()}