Skip to content

Commit 9c88af1

Browse files
Merge pull request #751 from ElectionDataAnalysis/documentation
Documentation
2 parents 5a93f70 + c9c9d95 commit 9c88af1

9 files changed

Lines changed: 666 additions & 429 deletions

File tree

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/Testing_Code_with_pytest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Results files for dataloading tests
2-
The dataloading tests rely on having some raw results data to load. And the results data should be various enough to test the various components of the data-loading code. In other words, effective testing requires a reasonable variety of input files. The repository does not contain sufficient results data for testing. A test set is available in a separate repository, [***TODO](***TODO). If [test_dataloading_by_ej.py](../tests/dataloading_tests/test_dataloading_by_ej.py) does not find results data, it will default to downloading the files from that repository.
2+
The dataloading tests rely on having some raw results data to load. And the results data should be various enough to test the various components of the data-loading code. In other words, effective testing requires a reasonable variety of input files. The repository does not contain sufficient results data for testing. A test set is available in a separate repository, [TestingData](https://github.com/ElectionDataAnalysis/TestingData). If [test_dataloading_by_ej.py](../tests/dataloading_tests/test_dataloading_by_ej.py) does not find results data, it will default to downloading the files from that repository.
33

44
# Sample Testing Session
55

docs/User_Guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ analyzer = dl.analyzer
471471
```
472472

473473
## Tabular Export
474-
The Analyzer class has a number of functions that allow you to aggregate the data for analysis purposes. For example, running the `.top_counts()` function exports files into your rollup_dataframe directory which with counts summed up at a particular reporting unit level. This function expects 4 arguments: the election, the jurisdiction, the reporting unit level at which the aggregation will occur, and a boolean variable indicating whether you would like the data aggregated by vote count type. For example, to export all 2020 General results in your database to a tab-separated file `tabular_results.tsv`:
474+
The Analyzer class has a number of functions that allow you to aggregate the data for analysis purposes. For example, to export all 2020 General results in your database to a tab-separated file `tabular_results.tsv`:
475475
```
476476
analyzer.export_election_to_tsv("tabular_results.tsv", "2020 General")
477477
```

src/electiondata/__init__.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,31 +2978,6 @@ def export_outlier_data(
29782978
)
29792979
return agg_results
29802980

2981-
def top_counts(
2982-
self, election: str, jurisdiction: str, sub_rutype: str, by_vote_type: bool
2983-
) -> Optional[str]:
2984-
"""
2985-
Inputs:
2986-
election: str,
2987-
jurisdiction: str,
2988-
sub_rutype: str, ReportingUnitType (e.g., 'county') to which the results should be rolled up
2989-
by_vote_type: bool, if true, results will be reported by vote type. If false, only totals will be reported
2990-
2991-
Puts file with results into a subdirectory (labeled by election and jurisdiction name)
2992-
of the reports_and_plots_dir specified in the Analyzer's param_file.
2993-
"""
2994-
jurisdiction_id = db.name_to_id(self.session, "ReportingUnit", jurisdiction)
2995-
election_id = db.name_to_id(self.session, "Election", election)
2996-
err = an.export_rollup(
2997-
self.session,
2998-
self.reports_and_plots_dir,
2999-
jurisdiction_id=jurisdiction_id,
3000-
sub_rutype=sub_rutype,
3001-
election_id=election_id,
3002-
by_vote_type=by_vote_type,
3003-
)
3004-
return err
3005-
30062981
def export_nist(
30072982
self,
30082983
election: str,
@@ -3829,7 +3804,7 @@ def external_data_exists(
38293804

38303805
connection = an.session.bind.raw_connection()
38313806
cursor = connection.cursor()
3832-
df = db.read_external(cursor, election_id, jurisdiction_id, ["Label"])
3807+
df = db.read_external_cursor(cursor, election_id, jurisdiction_id, ["Label"])
38333808
cursor.close()
38343809

38353810
# if no data found

0 commit comments

Comments
 (0)