first commit

This commit is contained in:
2026-05-21 08:40:24 -04:00
commit b084545275
711 changed files with 3659856 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
Metadata-Version: 2.4
Name: milestone_attribution_graph_library_module
Version: 0.1.0
Summary: Internal PASBDC graph making scripts used to generate figures for the milestone attribution analysis.

View File

@@ -0,0 +1,7 @@
pyproject.toml
milestone_attribution_graph_library_module/__init__.py
milestone_attribution_graph_library_module/milestone_graph_analysis.py
milestone_attribution_graph_library_module.egg-info/PKG-INFO
milestone_attribution_graph_library_module.egg-info/SOURCES.txt
milestone_attribution_graph_library_module.egg-info/dependency_links.txt
milestone_attribution_graph_library_module.egg-info/top_level.txt

View File

@@ -0,0 +1 @@
milestone_attribution_graph_library_module

View File

@@ -0,0 +1,7 @@
from .milestone_graph_analysis import make_attribution_pie, make_attribution_grouped_chart
__all__ = [
'make_attribution_pie',
'make_attribution_grouped_chart'
]

View File

@@ -0,0 +1,112 @@
import plotly.express as px
import os
import pandas as pd
from typing import Dict, List
from constants_module import NEOSERRA_COLUMNS, OUT_COLUMNS
def make_attribution_pie(
milestone_data:pd.DataFrame,
title:str,
date_note:str,
col_documentation_level:str=OUT_COLUMNS.milestone_documentation_level,
level_colors:Dict[str, str]={
"Not Documented":"#f33e3e",
"Affirmation Missing":"#f3b83e",
"Documented":"#79be54",
}
):
fig = px.pie(
milestone_data,
title=f"<span style='font-size:12px;'>{title}</span>",
names=col_documentation_level,
color=col_documentation_level,
color_discrete_map=level_colors
)
fig.update_layout(
legend=dict(
orientation="h", # 'h' for horizontal
yanchor="top", # Anchor the top of the legend box
y=-0.05, # slightly below the chart
xanchor="center", # Center the legend horizontally
x=0.5
),
margin=dict(t=50, b=120, l=50, r=50)
)
fig.add_annotation(
text=f"Analysis includes {milestone_data.shape[0]} milestones based on the Center's scorecard data as of {date_note}",
xref="paper", yref="paper",
x=0.5,
y=-0.24,
showarrow=False,
font=dict(size=12, color="gray")
)
return fig
'''
blank
director confirmed (i saw gannon still had this) - should be red by default
requested on ecenter
ecenter
quarterly impact survey
I&O form
email from client
other
'''
def make_attribution_grouped_chart(
milestone_data:pd.DataFrame,
title:str,
xaxis_order:List[str]=[
"Blank",
"Director Confirmed through Session Note Review",
"Requested on eCenter",
"Email from Client, Requested on eCenter",
"eCenter, Requested on eCenter",
"eCenter",
"Quarterly Assesment Survey",
"Impact & Outcomes Form",
"Email from Client",
"Email from Client, Impact & Outcomes Form",
],
col_documentation_level:str=OUT_COLUMNS.milestone_documentation_level,
col_attribution_source:str=NEOSERRA_COLUMNS.milestone_attribution_source,
level_colors:Dict[str, str]={
"Not Documented":"#f33e3e",
"Affirmation Missing":"#f3b83e",
"Documented":"#79be54",
},
):
# Aggregate data for px.bar to ensure trace.y is populated for synchronization
counts = milestone_data.groupby([col_attribution_source, col_documentation_level], dropna=False).size().reset_index(name='count')
fig = px.bar(counts,
x=col_attribution_source,
y='count',
color=col_documentation_level,
barmode='group',
text_auto=True,
color_discrete_map=level_colors,
title=title,
width=2000,
height=1200
)
fig.update_layout(
legend=dict(
orientation="h",
yanchor="top",
y=1.05,
xanchor="left",
x=-0.15
),
margin=dict(t=50, b=50, l=10, r=0),
yaxis_title='Number of Milestones'
)
existing_source = [s for s in xaxis_order if s in milestone_data[col_attribution_source].unique()]
fig.update_xaxes(categoryorder='array',
categoryarray=existing_source)
return fig

View File

@@ -0,0 +1,12 @@
# graph_generation/pyproject.toml
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "milestone_attribution_graph_library_module"
version = "0.1.0"
description = "Internal PASBDC graph making scripts used to generate figures for the milestone attribution analysis."
[tool.setuptools]
packages = ["milestone_attribution_graph_library_module"]