Skip to content

feat(export): patient replace person - ref gestion-de-projet#3198#3200 - #504

Merged
cesar-richard merged 1 commit into
developfrom
3198-3200#patient-replace-person
May 7, 2026
Merged

feat(export): patient replace person - ref gestion-de-projet#3198#3200#504
cesar-richard merged 1 commit into
developfrom
3198-3200#patient-replace-person

Conversation

@tfi90

@tfi90 tfi90 commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Fixes

Fixes ID/design-et-produit/ipa/cohort360/gestion-de-projet#3198
Fixes ID/design-et-produit/ipa/cohort360/gestion-de-projet#3200

Description

patient replace person

Summary by CodeRabbit

  • Refactor
    • Updated internal table references to use consistent naming conventions across export workflows.
    • Aligned test fixtures and validation data to reflect updated table and column naming standards.

@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36d566f0-7834-459c-be73-0c09a90caf28

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR systematically updates the table name reference from "person" to "Patient" across the codebase, including the ExportAPI.required_table initialization and all corresponding test fixtures, test data, and test assertions. One test fixture also updates column names in the CSV export table definition.

Changes

Cohort / File(s) Summary
Exporter API
exporters/apis/export_api.py
Updated required_table initialization from "person" to "Patient".
Exporter Test Fixtures & Tests
exporters/tests/base_test.py, exporters/tests/test_csv_exporter.py, exporters/tests/test_hive_exporter.py, exporters/tests/test_xlsx_exporter.py
Updated ExportTable fixture and test data to use "Patient" instead of "person". base_test.py additionally changes CSV export table columns from ["person_id", "person_name"] to ["id", "name___official__family"].
Export Test Fixtures & Tests
exports/tests/test_export_downloader.py, exports/tests/test_service_export.py, exports/tests/test_view_export.py, exports/tests/test_view_export_request.py
Updated test fixture data and payloads to use "Patient" instead of "person" for ExportTable and export_tables entries.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop, a skip, a table renamed,
From "person" to "Patient"—the change proclaimed,
Through tests and fixtures, the update flows,
Like carrots replacing what once was sown,
Simple, consistent, from code to test—hooray!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: renaming 'person' to 'Patient' across the export module, which is reflected consistently in all modified files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 3198-3200#patient-replace-person

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
exporters/tests/base_test.py (1)

57-57: Consider extracting a shared table-name constant in test fixtures.

"Patient" is repeated across multiple fixture lines; using one constant in ExportersTestBase would reduce future rename churn.

♻️ Suggested refactor
 class ExportersTestBase(TestCaseWithDBs):
+    REQUIRED_TABLE_NAME = "Patient"
@@
-        self.csv_export_table = ExportTable.objects.create(export=self.csv_export,
-                                                           name="Patient",
+        self.csv_export_table = ExportTable.objects.create(export=self.csv_export,
+                                                           name=self.REQUIRED_TABLE_NAME,
@@
-        self.xlsx_export_table = ExportTable.objects.create(export=self.xlsx_export,
-                                                            name="Patient",
+        self.xlsx_export_table = ExportTable.objects.create(export=self.xlsx_export,
+                                                            name=self.REQUIRED_TABLE_NAME,
@@
-        self.hive_export_table = ExportTable.objects.create(export=self.hive_export,
-                                                            name="Patient",
+        self.hive_export_table = ExportTable.objects.create(export=self.hive_export,
+                                                            name=self.REQUIRED_TABLE_NAME,

Also applies to: 68-68, 74-74

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@exporters/tests/base_test.py` at line 57, Extract the repeated literal
"Patient" into a single class-level constant on ExportersTestBase (e.g.,
PATIENT_TABLE_NAME = "Patient") and update all test fixtures that currently use
the string literal (the repeated table-name occurrences in the fixtures) to
reference ExportersTestBase.PATIENT_TABLE_NAME instead; this centralizes the
name for easy renames and reduces duplication across the fixtures.
exporters/tests/test_hive_exporter.py (1)

12-12: Rename local test symbol/comments to patient for consistency.

Line 12 keeps person_table_name while value is "Patient". Renaming the variable (and related comment wording) would improve clarity and avoid mixed terminology in this suite.

Also applies to: 27-27, 41-41, 48-48, 54-54

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@exporters/tests/test_hive_exporter.py` at line 12, Rename the local test
symbol person_table_name to patient_table_name (or patient_table) and update any
comments that mention "person" to "patient" for consistency: locate the variable
declaration person_table_name = "Patient" and rename all references (including
assertions, fixtures, and comments around the same test file locations noted) so
they use patient_table_name/patient_table and matching comment wording; ensure
test helper names and any string comparisons remain unchanged except for the
identifier and comment text.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@exporters/tests/base_test.py`:
- Line 57: Extract the repeated literal "Patient" into a single class-level
constant on ExportersTestBase (e.g., PATIENT_TABLE_NAME = "Patient") and update
all test fixtures that currently use the string literal (the repeated table-name
occurrences in the fixtures) to reference ExportersTestBase.PATIENT_TABLE_NAME
instead; this centralizes the name for easy renames and reduces duplication
across the fixtures.

In `@exporters/tests/test_hive_exporter.py`:
- Line 12: Rename the local test symbol person_table_name to patient_table_name
(or patient_table) and update any comments that mention "person" to "patient"
for consistency: locate the variable declaration person_table_name = "Patient"
and rename all references (including assertions, fixtures, and comments around
the same test file locations noted) so they use patient_table_name/patient_table
and matching comment wording; ensure test helper names and any string
comparisons remain unchanged except for the identifier and comment text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 32b1b34b-cfbf-485a-b7f5-d8adfac9dd78

📥 Commits

Reviewing files that changed from the base of the PR and between 419c714 and 8da4b85.

📒 Files selected for processing (9)
  • exporters/apis/export_api.py
  • exporters/tests/base_test.py
  • exporters/tests/test_csv_exporter.py
  • exporters/tests/test_hive_exporter.py
  • exporters/tests/test_xlsx_exporter.py
  • exports/tests/test_export_downloader.py
  • exports/tests/test_service_export.py
  • exports/tests/test_view_export.py
  • exports/tests/test_view_export_request.py

@cesar-richard

Copy link
Copy Markdown
Collaborator

Conflits a gérer à cause du linter

@cesar-richard
cesar-richard force-pushed the 3198-3200#patient-replace-person branch from 8da4b85 to 9260b1e Compare May 6, 2026 11:46
@cesar-richard
cesar-richard changed the base branch from main to develop May 6, 2026 11:47
@cesar-richard
cesar-richard merged commit 4b0a19a into develop May 7, 2026
3 checks passed
@cesar-richard
cesar-richard deleted the 3198-3200#patient-replace-person branch May 7, 2026 08:42
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