Skip to main content

PSA-LPSD Tools

Project description

psalpsdtools

LPSDLogo_sm

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.

Features

Some of the features include:

Electronic Data Review Worksheet (EDRW)

  • 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

Built-in Functions

  • get_regions - returns a list of regions.

  • get_provinces - returns a list of provinces of a given region.

Requirements

Python 3.8 or later with all required dependencies installed. To install run:

pip install psalpsdtools

Usage

EDRW Updating

- Pre-requisites (for Chicken)

  • baseFolder should contain the S-D file.

  • inside baseFolder, a folder named Sources must exist, containing the regional folders and the provincial files inside.

    Screenshot 2023-06-28 171534

  • 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

- Example code:

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)

Built-in Functions

get_regions

Example code:

from psalpsdtools import PhRegPrv

philippines = PhRegPrv()
regions = philippines.get_regions()

for region in regions:
    print(region)

get_provinces

Example code:

from psalpsdtools import PhRegPrv

# Specifiy a region
regname = 'Caraga'

philippines = PhRegPrv()
provinces = philippines.get_provinces(regname)

for province in provinces:
    print(province)

Contribute

Issue Tracker: github.com/tondiaz/psalpsdtools/issues

Source Code: github.com/tondiaz/psalpsdtools

License

The project is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psalpsdtools-1.5.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file psalpsdtools-1.5.tar.gz.

File metadata

  • Download URL: psalpsdtools-1.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for psalpsdtools-1.5.tar.gz
Algorithm Hash digest
SHA256 ecaf9df26ac011730d586ef15a42eaf376fd2c98f87ce4da8b924e93d46cb06a
MD5 5cc5925c534211b79b63481433ca60d5
BLAKE2b-256 38c3751d2345c0298be99cb506d10099a31f00c6b5514c3cc3c2eaa8c3170089

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page