Skip to content

Commit

Permalink
Merge branch 'master' into population_estimate_by_asr
Browse files Browse the repository at this point in the history
  • Loading branch information
Bipnabraham authored Dec 10, 2024
2 parents 0f9311f + f88e1c0 commit 7e6b189
Show file tree
Hide file tree
Showing 169 changed files with 4,118 additions and 18,605 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ retry==0.9.2
shapely==1.8.5
urllib3==1.26.8
xarray==0.19.0
xlrd==1.2.0
xlrd
zipp
beautifulsoup4
ratelimit
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ shapely==1.8.5
tabula-py
urllib3==1.26.8
xarray==0.19.0
xlrd==1.2.0
xlrd
yapf
zipp
beautifulsoup4
Expand Down
24 changes: 17 additions & 7 deletions scripts/us_census/pep/monthly_population_estimate/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# US Census PEP: National Population Count by Residential Status and Military Status

## About the Dataset
This dataset has Population Count Estimates for the United States from the year 1980 to 2022 on a monthly basis.
This dataset has Population Count Estimates for the United States from the year 1980 on a monthly basis till latest year.

The population is categorized by residential status (resident,InArmedForcesOverseas), military status(Civilian,InArmedForces) and a combination of the same.

### Download URL
The data in txt/xls/xlsx formats are downloadable from within https://www2.census.gov/programs-surveys/popest/tables. The actual URLs are listed in file_urls.json.
The data in txt/xls/xlsx formats are downloadable from within https://www2.census.gov/programs-surveys/popest/tables. The actual URLs are listed in input_url.json.

#### API Output
These are the attributes that we will use
Expand Down Expand Up @@ -44,12 +44,22 @@ Run the test cases
```/bin/python3 scripts/us_census/pep/monthly_population_estimate/preprocess_test.py
```

### Import Procedure

[Updated the script on November 11, 2024]
Downloading input files is now integrated into preprocess.py, eliminating the need to run the separate download.sh script.
All source file URLs, including future URLs adhering to the same structure, are centrally managed in the input_url.json file.
All input files required for processing should be stored within the designated "input_files" folder.

### Import Procedure
### Downloading and Processing Data

The below script make a new folder named as input_data (if not already present) where the download.py script is present and will download the data into this folder.
`/bin/python3 scripts/us_census/pep/monthly_population_estimate/download.py`
To perform "download and process", run the below command:
python3 preprocess.py
Running this command generates input_fles and csv, mcf, tmcf files

The below script will generate csv and mcf files.
`/bin/python3 scripts/us_census/pep/monthly_population_estimate/preprocess.py`
If you want to perform "only process", run the below command:
python3 preprocess.py --mode=process

If you want to perform "only download", run the below command:
python3 preprocess.py --mode=download

243 changes: 0 additions & 243 deletions scripts/us_census/pep/monthly_population_estimate/download.py

This file was deleted.

51 changes: 0 additions & 51 deletions scripts/us_census/pep/monthly_population_estimate/download_test.py

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/us_census/pep/monthly_population_estimate/input_url.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"download_path": "https://www2.census.gov/programs-surveys/popest/tables/1990-2000/national/totals/nat-total.txt"
},
{
"download_path": "https://www2.census.gov/programs-surveys/popest/tables/2000-2009/state/totals/na-est2009-01.csv"
},
{
"download_path": "https://www2.census.gov/programs-surveys/popest/tables/2010-2019/national/totals/na-est2019-01.xlsx"
}

]
Loading

0 comments on commit 7e6b189

Please sign in to comment.