psalpsdtools is a file maintenance Python package tool designed specifically for the Livestock and Poultry Statistics Division to streamline file management and updating processes. This comprehensive package provides a user-friendly interface and a robust set of functionalities to efficiently organize, manipulate, and validate data files. From data cleaning and merging to filtering and report generation, this package offers a reliable solution to enhance productivity and ensure only accurate information are produced. Furthermore, this package is continuously evolving with ongoing development, promising future enhancements and additional functionalities to cater to the evolving needs of the division.
Some of the features include:
- Lookup and copying of values from the Supply-Disposition worksheet
- Pasting values to the EDRW output file
- Generation of output files by province, based on user specified inputs which includes:
- region
- commodity
- year
-
get_regions - returns a list of regions.
-
get_provinces - returns a list of provinces of a given region.
Python 3.8 or later with all required dependencies installed. To install run:
pip install psalpsdtools
-
baseFolder should contain the S-D file.
-
inside baseFolder, a folder named Sources must exist, containing the regional folders and the provincial files inside.
-
Provincial EDRW source files should have .xlsm extensions
-
Currently, source filename is expected to be "cc " + province name + "_year", e.g. 08 Agusan del Norte_23.xlsm
from psalpsdtools import Edrw
# Specify Region
regName = 'Caraga'
# Specify quarter
# Used in identifying which worksheet to paste the copied values from the S-D file.
qtr = 'Q1'
# Specify folder location of Sources and Final files.
# The S-D file should also be found here.
baseFolder = 'D:/EDRW/Q1'
# Specify S-D filename
# IMPORTANT! Only .xlsm or .xlsx extensions are accepted
sdFile = 'SD Q1 2023.xlsm'
# Commodity code i.e. 08=chicken, 09=duck, etc.
commcode = '08'
# Year
yr = '23'
# Call an instance of the Edrw package
myedrw = Edrw()
# Run update_sources with the parameters
myedrw.update_sources(regName,qtr,baseFolder,sdFile,commcode,yr)
Example code:
from psalpsdtools import PhRegPrv
philippines = PhRegPrv()
regions = philippines.get_regions()
for region in regions:
print(region)
Example code:
from psalpsdtools import PhRegPrv
# Specifiy a region
regname = 'Caraga'
philippines = PhRegPrv()
provinces = philippines.get_provinces(regname)
for province in provinces:
print(province)
Issue Tracker: github.com/tondiaz/psalpsdtools/issues
Source Code: github.com/tondiaz/psalpsdtools
The project is licensed under the MIT license.