Skip to content

Commit

Permalink
chore: Grant Column Support (#10)
Browse files Browse the repository at this point in the history
* Add support for more grant column names
* Support for 0 matching dataframs
  • Loading branch information
cbolles authored Aug 26, 2024
1 parent 66f9a9a commit 2de95ce
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/frp/frp/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def _match(self, df: pd.DataFrame, frp_title: str) -> pd.DataFrame:
Handles running the FRP title matching against the rows
of the dataframe
"""
# If no data, don't run matching
if df.empty:
matches = df.copy()
matches['Part of FRP'] = False
return matches

# Function which is applied to every row in the dataframe
def apply_matcher(row: pd.Series) -> pd.Series:
# First get all shared mappings
Expand Down
22 changes: 20 additions & 2 deletions packages/frp/frp/grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,26 @@ class GrantAnalysis(Analysis):
def __init__(self, matcher: Matcher, config: dict):
columns = [
ColumnConversion('ReportingDate', 'string', ['Reporting date 1']),
ColumnConversion('Title', 'string', ['Award Title OR Proposal Title']),
ColumnConversion('Amount', 'float', ['Total Anticipated Amount OR Total Requested Amount amount']),
ColumnConversion('Title', 'string', [
'Award Title OR Proposal Title',
'Proposal Title OR Award Title',
'Award Title OR Proposal Title OR Title',
'Award Title OR Title OR Proposal Title',
'Proposal Title OR Title',
'Proposal Title OR Award Title OR Title',
'Proposal Title OR Title OR Award Title',
'Proposal Title',
'Title'
]),
ColumnConversion('Amount', 'float', [
'Total Anticipated Amount OR Total Requested Amount amount',
'Total Requested Amount OR Total Anticipated Amount amount',
'Total Anticipated Amount OR Total Requested Amount OR Amount amount',
'Total Anticipated Amount OR Amount OR Total Requested Amount amount',
'Total Requested Amount OR Amount OR Total Anticipated Amount amount',
'Total Requested Amount amount',
'Total Anticipated Amount amount'
]),
ColumnConversion('Status', 'string', ['Status'])
]

Expand Down

0 comments on commit 2de95ce

Please sign in to comment.