Skip to content

Refactor PDF Report Generation for Style and Sharing Options#54

Open
aajain2 wants to merge 26 commits intomainfrom
exportformatting
Open

Refactor PDF Report Generation for Style and Sharing Options#54
aajain2 wants to merge 26 commits intomainfrom
exportformatting

Conversation

@aajain2
Copy link
Contributor

@aajain2 aajain2 commented Mar 13, 2025

Refactor PDF Report Generation for Style and Sharing Options

♻️ Current situation & Problem

The CoughSync app previously lacked a comprehensive way to share cough tracking data with healthcare providers. Users could only take screenshots of their data visualizations, making it difficult for clinicians to analyze trends or get a full picture of the patient's condition. There was no standardized format for sharing this critical health information, and no way to print or email the data directly from the app. This limited the app's usefulness in clinical settings and created barriers to effective patient-provider communication.

⚙️ Release Notes

  • Added comprehensive PDF report generation with user-friendly formatting
  • Implemented multiple report sharing options including direct share, email, and "save as"
  • Enhanced Print functionality in the share sheet for physical report copies
  • Created professional report layout with branded header, date stamp, and confidentiality footer
  • Designed informative report cards showing percentage changes and peak cough times
  • Generated detailed trend charts with proper axes, grid lines, and data visualization for daily, weekly, and monthly time periods

📚 Documentation

This update transforms how patient data is shared with healthcare providers by implementing a professional PDF report system. Rather than simple screenshots, the new implementation generates a complete clinical report document with structured sections. The report begins with a branded header and date stamp to ensure proper documentation. The summary section includes report cards for daily, weekly, and monthly timeframes, each displaying percentage changes in cough frequency with directional indicators (up/down arrows) and peak time information that clinicians can use for treatment planning. The trend analysis section presents three comprehensive charts showing daily patterns (past week), weekly patterns (past month), and monthly patterns (past year). Each chart is professionally rendered with proper axes, gridlines, and data points to allow clinicians to quickly identify patterns and trends. The charts use consistent scaling and visualization techniques to ensure accurate interpretation of the data. The sharing functionality has been enhanced with multiple options: users can email the report directly to their healthcare provider with a pre-formatted subject line and message, save the PDF to their device, or use the system share sheet to send via any available method. We've also ensured the print option is available in the share sheet, allowing for physical copies when needed. The entire report is formatted for standard US Letter size (8.5" x 11") for consistent printing results.

✅ Testing

The PDF generation and sharing functionality has been tested on iOS devices for consistent rendering and behavior. Report cards and trend charts accurately display data, and sharing options work seamlessly with apps. Print functionality has been verified for proper formatting.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@aajain2 aajain2 requested a review from MiguelAFH March 13, 2025 07:41
@jennleww jennleww self-requested a review March 13, 2025 11:17
Copy link
Contributor

@jennleww jennleww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Report looks a lot better than before, great that it also shows graphs now. In the future we can add more medical insights to it.

@aajain2 aajain2 enabled auto-merge (squash) March 13, 2025 19:44
@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 1.07991% with 458 lines in your changes missing coverage. Please review.

Project coverage is 49.56%. Comparing base (a571453) to head (e462da6).

Files with missing lines Patch % Lines
CoughSync/Report/PDFDrawingHelpers.swift 0.00% 261 Missing ⚠️
CoughSync/Report/PDFReportGenerator.swift 0.00% 121 Missing ⚠️
CoughSync/Report/ReportView.swift 6.18% 76 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #54      +/-   ##
==========================================
- Coverage   59.17%   49.56%   -9.60%     
==========================================
  Files          36       38       +2     
  Lines        2150     2577     +427     
==========================================
+ Hits         1272     1277       +5     
- Misses        878     1300     +422     
Files with missing lines Coverage Δ
CoughSync/Report/ReportView.swift 41.67% <6.18%> (-8.04%) ⬇️
CoughSync/Report/PDFReportGenerator.swift 0.00% <0.00%> (ø)
CoughSync/Report/PDFDrawingHelpers.swift 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a571453...e462da6. Read the comment docs.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aajain2 aajain2 disabled auto-merge March 13, 2025 21:41
@aajain2 aajain2 enabled auto-merge (squash) March 13, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants