Need to simplify this to a series of steps that's easy to follow.
-
Update the CROP Python backend to return the entire strings for "Percent depth of coverage" and "Mean depth of coverage" but do this only for the report type
RT_EXOME_DIAGNOSTIC_V4
. Forexome_v4
, the returned dictionary values forpercent_depth_of_coverage
andmean_depth_of_coverage
will be strings likeProportion of tested genes with high confidence: 99.1%
andMean depth of coverage: 50x
.For all other exome report types (
RT_EXOME_DIAGNOSTIC
,RT_EXOME_DIAGNOSTIC_V2
, &RT_EXOME_DIAGNOSTIC_V3
), the existing behavior, must be preserved in which thepercent_depth_of_coverage
andmean_depth_of_coverage
dict values are still returned as stringified values of only the numbers such as99.8%
and50x
. This is because the report rendering service code will be updated asynchronous to these changes, and we don't control when those rendering service changes are released.The relevant code needs updates in at least 2 places.
- In
ExomeV2ReportWriter._get_coverage_statistics_summary()
which is the function that generates the coverage statistics summary data for the CROP UI for display on exome v2, exome v3, and exome v4 reports. - In
document_writer._get_coverage_summary()
where the coverage statistics summary is generated for the PDFs for all 4 exome report types v1 through v4.
- In
-
Update the CROP UI code for the
<CoverageStatisticsSummary>
React component to inspect the string values forpercent_depth_of_coverage
andmean_depth_of_coverage
that are provided to it such that if those strings already contain their prefixes such asPercent depth of coverage at 20x:
,Proportion of tested genes with high confidence:
, orMean depth of coverage:
, then display the entire string values for those fields. We've suggested perhaps using a regex to realize this check, but other options are possible such as String.prototype.startsWith(). If the provided values do not have their prefix texts, then continue rendering with the existing behavior in which the prefix text for the numerical values that are hardcoded in the UI asPercent depth of coverage at 20x:
andMean depth of coverage:
are used for the rendering.See https://github.com/invitae-internal/invitae-crop/blob/develop/crop/app/web/src/components/views/reportDetail/tabs/report/CoverageStatisticsSummary.tsx#L26 and https://github.com/invitae-internal/invitae-crop/blob/develop/crop/app/web/src/components/views/reportDetail/tabs/report/CoverageStatisticsSummary.tsx#L29
-
Apply the same logic updates made in the CROP UI code to the
<CoverageStatisticsSummary>
React component in RDIN-618 to the corresponding React component in the rendering service code that's also named<CoverageStatisticsSummary>
. Just like on the CROP UI, the rendering service version of this component must also inspect the string values formeanDepthOfCoverage
&percentDepthOfCoverage
that it's provided with a regular expression or with String.prototype.startsWith() to determine if it needs to render the hardcoded values for the prefixesPercent depth of coverage at 20x:
andMean depth of coverage:
or only render the string values coming from the CROP backend that already include the correct coverage summary stats prefixes. The logic to generate these prefixes on the CROP Python backend will be added in RDIN-618 as well.The
<CoverageStatisticsSummary>
React component code is in therendering-service
repo @ https://github.com/invitae-internal/rendering-service/blob/main/src/components/Reports/CoverageStatisticsSummary/CoverageStatisticsSummary.tsxFor reference the
<CoverageStatisticsSummary>
React component lives in the CROP UI code at https://github.com/invitae-internal/invitae-crop/blob/develop/crop/app/web/src/components/views/reportDetail/tabs/report/CoverageStatisticsSummary.tsx#L18 -
OPTIONAL - NEED TO FILE TICKET: After the PDF rendering service updates made to the
<CoverageStatisticsSummary>
React component in RDIN-748 are released in production, we can return to the CROP backend inreport_writer.py
anddocument_writer.py
and update_get_coverage_statistics_summary()
to always return the full coverage summary statistics texts including the prefixes forpercent_depth_of_coverage
andmean_depth_of_coverage
for all report types. This should work not only forRT_EXOME_DIAGNOSTIC_V4
, but for all other report types so that the returned text is now independent of thereport_type
and always includes the prefix texts such asPercent depth of coverage at 20x:
,Mean depth of coverage:
, and `. We can also do the reversion of the special logic implemented on the CROP web UI in the same ticket as this one where we handle the reversion of the report type specific logic on the backend. -
OPTIONAL - NEED TO FILE JIRA TICKET: After the changes in step 4) are released in production, we can return to both the CROP UI and the rendering service and remove the string inspection logic added in steps 2) and 3) to both versions of the
<CoverageStatisticsSummary>
React component, so that it always renders the full text it's provided on thepercent_depth_of_coverage
andmean_depth_of_coverage
fields and it no longer uses hardcoded prefixes in the rendering.