A repository for the CNP/NCCS Nonprofit Regulatory Environment project.
The code here focuses on using hand-collected data produced by research collaborators and entered into Excel sheets, which are then read into R to clean and restructure.
The raw files that were provided by the research team at in data-raw/tidy-states.
The Digitized Legal Compendium file is the primary data wrangling file for the first stages. It also suggests some standards for how to structure the file and format legal citations moving forward to scale teh work in the next phase.
The semi-clean file called 02-data-inter/ALL-STATES-FORMATTED.CSV is here: DOWNLOAD
The big changes that were made:
- Variables were renamed for consistency and Legal Compendium descriptive labels were added.
- IDs were inconsistent in the raw files (state names were incorrect leading to duplicate IDs, other ID names were inconsistent throughout the individual state files)
- Text encoding from copied HTML was causing problems, so text fields were put through text sanitizers to remove any exotic encodings and ensure text is clean and consistent when stored in CSV files.
- Section numbering fields, which consist of numbers and punctuation, were being interpretted as dates or getting corrupted in the usual excel ways. To preserve the integrity a text tag needs to be added to the start of each text field. For example, the section fields now start with {SS}:
- The Section Symbol is non-unicode and thus was getting muddled, so it should be used sparingly (for example, it crashed this page when it was added).
Outstanding issues:
- The section fields need to be cleaned and reconciled.
- The Regulation Indicator field (reg_indicator) was inconsistent and it's unclear if it is accurate.
- Please review variable names to see if we can make them intuitive.
Currently we group the regulations as:
- reg_type (the high level column group in the legal compendium)
- reg_rule (each column of the LC)
- reg_body (which body is responsible for administering the regulation: AG, Other, and I added "Not Specified" for cases that were blank)
- reg_action (describes what type of regulation it is - requirement, exemption, remedy, etc.)
I debated instead using "reg_group and reg_type instead of reg_type and reg_rule). Open to suggestions.
I played with descriptive stats but could not find a lot that was interesting or insightful beyond the basic coverage for specific types of laws and variance in the extensiveness of the regulatory environments across states.
Otherwise I think people might want to query the statutes:
- By a regulatory type to see how laws vary across geographies
- By a geograph to see what laws exist
- By a combination of type and geography to look up a specific law
These report templates were an attempt to render the text data in a way that makes it easy to digest. It also highlights the data integrity issues that need to be fixed.
I can still add the user interface but I need some feedback on what is actually useful.
We can create tables that look similar to the original LC Excel file with YES/NO in the cells and hyperlinks to the notes and text on each section.
REG1 | REG2 | |
---|---|---|
STATE1 | link | link |
STATE2 | link | link |
Just really wasn't sure what people want for an interface.
Report templates that summarize nonprofit statutes covered within each state.
- Alabama State Report
- Alaska State Report
- Arizona State Report
- Arkansas State Report
- California State Report
- Colorado State Report
- Connecticut State Report
- Delaware State Report
- Florida State Report
- Georgia State Report
- Hawaii State Report
- Idaho State Report
- Illinois State Report
- Indiana State Report
- Iowa State Report
- Kansas State Report
- Kentucky State Report
- Louisiana State Report
- Maine State Report
- Maryland State Report
- Massachusetts State Report
- Michigan State Report
- Minnesota State Report
- Mississippi State Report
- Missouri State Report
- Montana State Report
- Nebraska State Report
- Nevada State Report
- New Hampshire State Report
- New Jersey State Report
- New Mexico State Report
- New York State Report
- North Carolina State Report
- North Dakota State Report
- Ohio State Report
- Oklahoma State Report
- Oregon State Report
- Pennsylvania State Report
- Rhode Island State Report
- South Carolina State Report
- South Dakota State Report
- Tennessee State Report
- Texas State Report
- Utah State Report
- Vermont State Report
- Virginia State Report
- Washington State Report
- Washington, D.C. State Report
- West Virginia State Report
- Wisconsin State Report
- Wyoming State Report
See the STATE-REPORT-TEMPLATE.QMD file for details on replicating.
###
### RENDER ALL REPORTS
wd <- "file/path/here/REPORTS/STATE/"
fn <- "ALL-STATES-FORMATTED.CSV"
TEMPLATE <- "STATE-REPORT-TEMPLATE.qmd"
setwd( wd )
render_state_report <- function( STATE ){
outfn <- paste0( STATE, ".html" )
quarto::quarto_render(
input = paste0( wd, "/", TEMPLATE ),
output_file = outfn,
execute_params = list(
state = STATE ) )
}
STATE <-
c("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA",
"MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY",
"NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX",
"UT", "VT", "VA", "WA", "DC", "WV", "WI", "WY")
# ONE AT A TIME
render_state_report( STATE="WY" )
# ALL TOGETHER
purrr::walk( STATE, render_state_report )
Reports that summarize existing legislation on each individual regulatory type across all states.
- BIFURC Report: Bifurcated Regulatory Structure
- REGIOF Report: Registration Office
- ASSETS Report: Sale of Assets
- MERGER Report: Mergers
- AMMEND Report: Certificate of Amendments
- VOLUNT Report: Voluntary Dissolutions
- JUDICI Report: Judicial Dissolutions
- ADMINI Report: Administrative Dissolutions
- STATUT Report: Has Statute
- OVERSI Report: Requires Notice or Oversight
- FILING Report: Requires Filing
- AUDITS Report: Requires Audit
- THRESH Report: Audit Threshold
- REGIST Report: Registration Law
- RELIGI Report: Religious Organizations
- SMALLO Report: Small organizations
- EDUCAT Report: Educational Institutions
- GOVMNT Report: Governmental Organizations
- HOSPIT Report: Hospitals
- VETERA Report: Veterans organizations
- FNDYES Report: Foundations
- FNDNOS Report: Foundations that don't solicit contributions
- CTRUST Report: Charitable Trusts
- PTOEDU Report: Parent-Teacher Organizations
- CONGRE Report: Reports to congress
- NONSOL Report: Non-soliciting
- MEMFRA Report: Fraternal/ Membership
- POLITI Report: Political Orgs
- OTHTYP Report: Other
- DISSOL Report: Dissolution
- BRDRMV Report: Removal of Board Members
- COMREG Report: Does the state require registration by commercial fundraisers?
- COUNSL Report: Does the state require registration by fundraising counsel?
- VENTUR Report: Does the state oversee commercial-coventuring (e.g. by requiring that the co-venture be registered or by requiring that the charitable organization files the co-venture contract)?
- NOTICE Report: Does the state require the fundraisers to provide notice to the regulator before any solicitation campaign (in addition to annual registration and/or filing the contract)?
- DDONOR Report: Does the state require specified disclosures to donors?
- CNTRCT Report: Does the state require a copy of any contract between a charitable organization and a commercial fundraiser or fundraising counsel be filed with the regulator?
- ANNUAL Report: Does the state require annual financial reporting by commercial fundraisers?
- FINANC Report: Does the state require annual financial reporting by charitable organizations in addition to filing a copy of the 990 with the regulator (if filing 990 is required)?
- BONDNG Report: Does the state require bonding of professional fundraisers?
See RULE-REPORT-TEMPLATE.QMD for the replication template.
###
### RENDER REPORTS
###
wd <- "your/file/path/REPORTS/RULES"
setwd( wd )
TEMPLATE <- "RULE-REPORT-TEMPLATE.QMD*"
render_rule_report <- function( RULE ){
outfn <- paste0( RULE, ".html" )
quarto::quarto_render(
input = paste0( wd, "/", TEMPLATE ),
output_file = outfn,
execute_params = list(
rule = RULE,
fpath = fpath ) )
}
rules <-
c("BIFURC", "REGIOF", "ASSETS", "MERGER", "AMMEND", "VOLUNT",
"JUDICI", "ADMINI", "STATUT", "OVERSI", "FILING", "AUDITS", "THRESH",
"REGIST", "RELIGI", "SMALLO", "EDUCAT", "GOVMNT", "HOSPIT", "VETERA",
"FNDYES", "FNDNOS", "CTRUST", "PTOEDU", "CONGRE", "NONSOL", "MEMFRA",
"POLITI", "OTHTYP", "DISSOL", "BRDRMV", "COMREG", "COUNSL", "VENTUR",
"NOTICE", "DDONOR", "CNTRCT", "ANNUAL", "FINANC", "BONDNG")
# ONE AT A TIME
render_rule_report( RULE = "BIFURC" )
# ALL TOGETHER
purrr::walk( rules, make_links2 )