Skip to content

Commit

Permalink
Merge pull request #23 from dsih-artpark/v3
Browse files Browse the repository at this point in the history
V3 merge - merging PR and will create tag as well.
  • Loading branch information
snehasaisneha authored May 29, 2024
2 parents 900e12d + 8800caa commit 3a93fb7
Show file tree
Hide file tree
Showing 20 changed files with 1,229 additions and 1,078 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@ dmypy.json
.DS_Store

# All Data Files
*.csv
*.csv
data/**
testing.py
_src/**
4 changes: 2 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# README.MD - epipipeline v2.0.11
# README.MD - epipipeline v3.0.0

This repository contains code that can be used to standardise linelists and summaries.

Expand All @@ -9,6 +9,6 @@ The standards currently used are:
1. Linelists: [YAML](https://raw.githubusercontent.com/dsih-artpark/data_documentation/production/documentation/EP/EP0005DS0014-KA_Dengue_LL/datadictionary.yaml), [MD](https://raw.githubusercontent.com/dsih-artpark/data_documentation/production/documentation/EP/EP0005DS0014-KA_Dengue_LL/datadictionary.MD)
2. Daily Summaries: [YAML](https://raw.githubusercontent.com/dsih-artpark/data_documentation/production/documentation/EP/EP0006DS0015-KA_Dengue_Daily_SUM/datadictionary.yaml), [MD](https://raw.githubusercontent.com/dsih-artpark/data_documentation/production/documentation/EP/EP0006DS0015-KA_Dengue_Daily_SUM/datadictionary.md)

This package's latest stable release, v2.0.11, supports Karnataka data. The package is still in a limited beta, and documentation and feature addition is underway.
This package's latest stable release, v3, supports Karnataka data. The package is still in a limited beta, and documentation and feature addition is underway.

To install the package, copy the following snippet:
334 changes: 329 additions & 5 deletions poetry.lock

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
[tool.poetry]
name = "epipipeline"
version = "2.0.11"
version = "3.0.0"
description = ""
authors = ["Sai Sneha <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.9.0"
pandas = "^2.2.0"
boto3 = "^1.34.40"
requests = "^2.31.0"
fuzzywuzzy = "^0.18.0"
openpyxl = "^3.1.2"
python-levenshtein = "^0.25.0"
pyyaml = "^6.0.1"
ipython = "^8.0.0"
dataio = {git = "[email protected]:dsih-artpark/dataio.git"}


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff.lint]
select = ["E", "F", "W", "I", "FLY", "RUF", "B", "ICN"]

[tool.ruff]
line-length = 140
19 changes: 19 additions & 0 deletions src/epipipeline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
from importlib.metadata import version

import pandas as pd

from epipipeline.logging_config import setup_logging

__version__ = version(__name__)
setup_logging()


def get_regionIDs(*, regionIDs_path="data/GS0015DS0034-LGD_Region_IDs_and_Names/regionids.csv"):

regionIDs_df = pd.read_csv(regionIDs_path)

regionIDs_dict = {}
for _, row in regionIDs_df.iterrows():
regionIDs_dict[row["regionID"]] = {"regionName": row["regionName"],
"parentID": row["parentID"]
}
return regionIDs_df, regionIDs_dict

66 changes: 66 additions & 0 deletions src/epipipeline/logging_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# epipipeline/logging_config.py
import logging
import logging.config

def setup_logging(default_level='WARNING'):
"""
Set up logging configuration.
Args:
default_level (str): The default logging level ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
"""
default_level = default_level.upper()
if default_level not in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
raise ValueError(f"Invalid logging level: {default_level}")

logging_config = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'standard',
},
'file': {
'class': 'logging.FileHandler',
'formatter': 'standard',
'filename': 'epipipeline.log',
},
},
'loggers': {
'': {
'handlers': ['console', 'file'],
'level': default_level,
'propagate': True,
},
'epipipeline': {
'handlers': ['console', 'file'],
'level': default_level,
'propagate': False,
},
}
}

logging.config.dictConfig(logging_config)

def set_logging_level(level):
"""
Set the logging level for the 'epipipeline' logger and all its handlers.
Args:
level (str): The logging level to set ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
"""
level = level.upper()
if level not in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
raise ValueError(f"Invalid logging level: {level}")

logger = logging.getLogger('epipipeline')
logger.setLevel(level)

for handler in logger.handlers:
handler.setLevel(level)
Loading

0 comments on commit 3a93fb7

Please sign in to comment.