Skip to content

Commit

Permalink
Adds comparison ALL bar for HIV Black Women (SatcherInstitute#3665)
Browse files Browse the repository at this point in the history
# Description and Motivation
<!--- bulleted, high level items. use keywords (eg "closes SatcherInstitute#144" or
"fixes #4323") -->

- adds HIV Black Women for SatcherInstitute#3627 by updating the MetriccConfig
- allow any subpopAge to pass through to the comparison All Bar, for
example all Black Women HIV topics and their gen. pop. equivalent use
ages 13+

## Has this been tested? How?

passing

## Screenshots (if appropriate)

<img width="1194" alt="Screenshot 2024-09-12 at 8 32 51 PM"
src="https://github.com/user-attachments/assets/3d8e146f-1ac3-424e-9136-4c75b361ea10">
<img width="1194" alt="Screenshot 2024-09-12 at 8 33 07 PM"
src="https://github.com/user-attachments/assets/e8776720-16b9-47aa-829a-44c52a6e070c">
<img width="1194" alt="Screenshot 2024-09-12 at 8 33 17 PM"
src="https://github.com/user-attachments/assets/9467b37d-bb30-4f73-885b-cbddbb08b011">


## Types of changes

(leave all that apply)

- New content or feature

## New frontend preview link is below in the Netlify comment 😎
  • Loading branch information
benhammondmusic authored and kccrtv committed Sep 16, 2024
1 parent 54733a6 commit 53f9f94
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
4 changes: 4 additions & 0 deletions frontend/src/cards/CardWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function CardWrapper(props: {
expanded?: boolean
isCompareCard?: boolean
className?: string
hasIntersectionalAllCompareBar?: boolean
}) {
const [screenshotTargetRef, downloadTargetScreenshot] = useDownloadCardImage(
props.downloadTitle,
Expand Down Expand Up @@ -80,6 +81,9 @@ function CardWrapper(props: {
queryResponses={queryResponses}
showDefinition={props.scrollToHash === 'rate-map'}
isCompareCard={props.isCompareCard}
hasIntersectionalAllCompareBar={
props.hasIntersectionalAllCompareBar
}
/>
)}
</article>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/cards/SimpleBarChartCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function SimpleBarChartCardWithKey(props: SimpleBarChartCardProps) {
reportTitle={props.reportTitle}
elementsToHide={elementsToHide}
className={`rounded-sm relative m-2 p-3 ${defaultClasses} ${props.className}`}
hasIntersectionalAllCompareBar={rateComparisonConfig !== undefined}
>
{([rateQueryResponseRate, rateQueryResponseRateAlls], metadata) => {
// for consistency, filter out any 'Unknown' rows that might have rates (like PHRMA)
Expand All @@ -173,6 +174,8 @@ function SimpleBarChartCardWithKey(props: SimpleBarChartCardProps) {
rateConfig.metricId,
])

const comparisonAllSubGroup = props.dataTypeConfig.ageSubPopulationLabel

return (
<>
{hideChart ? (
Expand Down Expand Up @@ -202,6 +205,7 @@ function SimpleBarChartCardWithKey(props: SimpleBarChartCardProps) {
usePercentSuffix={isPctType(rateConfig.type)}
fips={props.fips}
useIntersectionalComparisonAlls={!!rateComparisonConfig}
comparisonAllSubGroup={comparisonAllSubGroup}
/>
{isIncarceration && (
<IncarceratedChildrenShortAlert
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/cards/ui/Sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface SourcesProps {
isMulti?: boolean
showDefinition?: boolean
isCompareCard?: boolean
hasIntersectionalAllCompareBar?: boolean
}

export function Sources(props: SourcesProps) {
Expand Down Expand Up @@ -96,6 +97,13 @@ export function Sources(props: SourcesProps) {

return (
<footer className='px-1 py-0 text-left text-smallest'>
{props.hasIntersectionalAllCompareBar && (
<p className='w-full'>
Note. "All People" represents the reference rate for the general
population in this area, including individuals of every race,
ethnicity, and sex grouping.
</p>
)}
<p className='w-full'>
<>{optionalDefinition}</>
<>{showNhFootnote ? 'Note. (NH) indicates ‘Non-Hispanic’. ' : ''}</>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/charts/SimpleHorizontalBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface SimpleHorizontalBarChartProps {
usePercentSuffix?: boolean
className?: string
useIntersectionalComparisonAlls?: boolean
comparisonAllSubGroup?: string
}

export function SimpleHorizontalBarChart(props: SimpleHorizontalBarChartProps) {
Expand Down Expand Up @@ -76,6 +77,7 @@ export function SimpleHorizontalBarChart(props: SimpleHorizontalBarChartProps) {
/* usePercentSuffix */ props.usePercentSuffix ?? false,
/* fips */ props.fips,
/* useIntersectionalComparisonAlls */ props.useIntersectionalComparisonAlls,
/* comparisonAllSubGroup */ props.comparisonAllSubGroup,
)}
actions={false}
/>
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/charts/simpleBarHelperFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ export function getSpec(
usePercentSuffix: boolean,
fips: Fips,
useIntersectionalComparisonAlls?: boolean,
comparisonAllSubGroup?: string,
): any {
function getMultilineAllOverride(fips: Fips): string {
// only swap the intersectional ALL for the ALL AVERAGE label if it's an intersectional topic
return useIntersectionalComparisonAlls
? `['${fips.getUppercaseFipsTypeDisplayName()} average', '(all people)']`
: MULTILINE_LABEL
if (useIntersectionalComparisonAlls) {
return `['${fips.getUppercaseFipsTypeDisplayName()} Average', 'All People', '${comparisonAllSubGroup || ''}']`
}
return MULTILINE_LABEL
}
const chartIsSmall = width < 400

Expand Down
21 changes: 21 additions & 0 deletions frontend/src/data/config/MetricConfigHivCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
{
categoryId: 'hiv',
dataTypeId: 'hiv_prevalence_black_women',
rateComparisonDataTypeId: 'hiv_prevalence',
mapConfig: womenHigherIsWorseMapConfig,
dataTypeShortLabel: 'Prevalence for Black Women',
fullDisplayName: 'HIV prevalence for Black women',
Expand Down Expand Up @@ -431,6 +432,12 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
'HIV prevalence for Black (NH) women per 100k people',
shortLabel: 'prevalence per 100k',
type: 'per100k',
rateComparisonMetricForAlls: {
chartTitle: '',
metricId: 'hiv_prevalence_per_100k',
shortLabel: 'All Black Women Ages 13+',
type: 'per100k',
},
rateNumeratorMetric: {
metricId: 'hiv_prevalence_black_women',
shortLabel: 'Black women living with HIV',
Expand All @@ -457,6 +464,7 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
{
categoryId: 'hiv',
dataTypeId: 'hiv_diagnoses_black_women',
rateComparisonDataTypeId: 'hiv_diagnoses',
mapConfig: womenHigherIsWorseMapConfig,
dataTypeShortLabel: 'New Diagnoses for Black Women',
fullDisplayName: 'New HIV diagnoses for Black women',
Expand Down Expand Up @@ -498,6 +506,12 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
columnTitleHeader: 'New HIV diagnoses for Black (NH) women per 100k',
shortLabel: 'diagnoses per 100k',
type: 'per100k',
rateComparisonMetricForAlls: {
chartTitle: '',
metricId: 'hiv_diagnoses_per_100k',
shortLabel: 'All Black Women Ages 13+',
type: 'per100k',
},
rateNumeratorMetric: {
metricId: 'hiv_diagnoses_black_women',
shortLabel: 'HIV diagnoses for Black women',
Expand All @@ -524,6 +538,7 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
{
categoryId: 'hiv',
dataTypeId: 'hiv_deaths_black_women',
rateComparisonDataTypeId: 'hiv_deaths',
mapConfig: womenHigherIsWorseMapConfig,
dataTypeShortLabel: 'Deaths for Black women',
fullDisplayName: 'HIV deaths for Black women',
Expand Down Expand Up @@ -564,6 +579,12 @@ export const HIV_BW_DISEASE_METRICS: DataTypeConfig[] = [
columnTitleHeader: 'HIV deaths for Black (NH) women per 100k people',
shortLabel: 'deaths per 100k',
type: 'per100k',
rateComparisonMetricForAlls: {
chartTitle: '',
metricId: 'hiv_deaths_per_100k',
shortLabel: 'All Black Women Ages 13+',
type: 'per100k',
},
rateNumeratorMetric: {
metricId: 'hiv_deaths_black_women',
shortLabel: 'HIV deaths for Black women',
Expand Down

0 comments on commit 53f9f94

Please sign in to comment.