Skip to content

Instantly share code, notes, and snippets.

View rruntsch's full-sized avatar

Randy Runtsch rruntsch

View GitHub Profile
@rruntsch
rruntsch / c_analytics_usa_gov_api.py
Last active March 3, 2022 16:51
Python c_analytics_usa_gov_api class and controller program to download reports from analytics.usa.gov
import requests
import json
class c_analytics_usa_gov_api:
"""
File name: c_analytics_usa_gov_api.py
Class name: c_analytics_usa_gov
Author: Randy Runtsch
Date: March 23, 2021
@rruntsch
rruntsch / c_download_prep_excel.py
Last active March 3, 2022 16:46
Python class c_download_prep_excel and controller program to download Excel workbooks from websites and prep them for analytics
"""
File name: c_download_prep_excel.py
Class: c_download_prep_excel
Author: Randy Runtsch
Date: March 27, 2021
Description: c_download_prep_excel is a Python class used to transcribe data from an Excel worksheet
into a new worksheet to prepare it for data analytics.
Comments in all but the constructor and get and set functions describe how the function
works and can be used.
@rruntsch
rruntsch / gist:ead0e0f842ac6d8f7f76f4c706f69819
Created April 10, 2021 18:58
Controller Python code to demonstrate Python c_e_info class use
from c_e_info import c_e_info
# Get the names of all Entrez databases as XML. Write the XML
# to a file and print it to the screen.
pubmed_db_list = c_e_info()
pubmed_db_list.write_db_xml('c://project_data/c_e_info/entrez_db_list.xml')
print(pubmed_db_list.get_db_xml())
# Get the details of the pubmed database as XML. Write the XML
@rruntsch
rruntsch / gist:7daefb71fcd99b9d62a057ad64d5c80a
Created April 10, 2021 19:16
Python c_e_info class that calls the NIH NCBI EInfo class utility to retrieve the list of Entrez databases or details about a specific Entrez database.
import requests
class c_e_info:
"""
Name: c_e_info.py
Author: Randy Runtsch
Date: April 10, 2021
Description: Python wrapper class for the NIH NCBI
EInfo API used to obtain a list of Entrez databases and statistics
@rruntsch
rruntsch / gist:265e026faf99cbc93cb8088b86c5dc13
Last active February 23, 2022 12:00
Python Class c_ncei_data_service_api
import requests
class c_ncei_data_service_api:
"""
Name: c_ncei_data_service_api.py
Author: Randy Runtsch
Date: April 11, 2021
Description: Python wrapper class for the NOA NCEI
Data Service API used to obtain weather and climate data.
@rruntsch
rruntsch / c_bls_data_api.py
Created August 16, 2021 18:56
Python class and calling code to retrieve US Consumer Price Index data from the Bureau of Labor Statistics (BLS) V2.0 Data API.
import requests
import json
class c_bls_data_api:
"""
File name: c_bls_data_api.py
Class name: c_bls_data_api
Author: Randy Runtsch
Date: August 12, 2021
-- get_city_population_dirty.sql
SELECT
City
, State_Code
, [Population]
FROM City_Population
ORDER BY
State_Code
, City;
-- get_us_city_population.sql
-- Clean city names and state codes.
SELECT
CASE
WHEN City = 'Aims' THEN 'Ames'
WHEN City = 'Amerillo' THEN 'Amarillo'
WHEN City = 'Austen' THEN 'Austin'
WHEN City = 'Boyse' THEN 'Boise'
WHEN City = 'Charlestown' THEN 'Charleston'
"""
Name: photo_exif_controller.py
Author: Randy Runtsch
Date: March 19, 2021
Update Date: August 28, 2021
Description: This module uses the c_photo_exif class, which in turn uses the ExifReader module
to identify the date and time when each of a series of
photographs was taken.
"""
"""
Name: c_photo_exif.py
Author: Randy Runtsch
Date: March 20, 2021
Update Date: August 28, 2021
Description: The c_photo_exif class opens all image files in the specified
folder, reads the Exif data from each file. It then gets the sunrise
and sunset times of the day the photo was taken. It then writes a subset
of the Exif data, and the sunrise and sunset times, as a row in a CSV file.