Skip to content

update the csv file#4

Merged
nikilok merged 8 commits intomainfrom
feature/update-csv
Jul 21, 2025
Merged

update the csv file#4
nikilok merged 8 commits intomainfrom
feature/update-csv

Conversation

@nikilok
Copy link
Owner

@nikilok nikilok commented Jul 21, 2025

No description provided.

@nikilok nikilok requested a review from Copilot July 21, 2025 11:37

This comment was marked as outdated.

@nikilok nikilok requested a review from Copilot July 21, 2025 12:00

This comment was marked as outdated.

@nikilok nikilok requested a review from Copilot July 21, 2025 12:20

This comment was marked as outdated.

- fix tests
- remove unwanted logger call
@nikilok nikilok requested a review from Copilot July 21, 2025 13:24

This comment was marked as outdated.

- improve tests
- rename file name to avoid confusion
@nikilok nikilok requested a review from Copilot July 21, 2025 13:36

This comment was marked as outdated.

@nikilok nikilok requested a review from Copilot July 21, 2025 14:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the application to use a configurable CSV file name instead of a hardcoded filename, making it easier to update data files without code changes. The changes introduce environment variable configuration for the CSV file path along with proper logging setup.

  • Replaces hardcoded CSV filename with environment variable CSV_SPONSORSHIP
  • Adds centralized logging configuration that must be initialized before other modules
  • Updates test setup to properly mock the new environment-dependent CSV loading

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/services/search.py Replaces hardcoded CSV filename with environment variable configuration
app/main.py Adds logging setup and reorders imports to ensure logging is configured first
app/logging_config.py New module providing centralized logging configuration
tests/services/test_search.py Adds test fixture to mock environment variables and CSV loading
.env.example Documents the new CSV_SPONSORSHIP environment variable

mock_read_csv.return_value = pd.DataFrame({"Organisation Name": ["dummy"]})

# Import after setting up the environment
global search_companies
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

Using global variables in tests is generally discouraged as it can lead to test coupling and unexpected side effects. Consider importing the function locally within each test that needs it, or use a proper fixture to provide the function.

Suggested change
global search_companies

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
global search_companies
from app.services.search import search_companies
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

Importing modules inside a fixture can cause issues with module caching and make tests harder to understand. Consider restructuring to import the module at the test level or use importlib to properly handle the dynamic import with environment setup.

Suggested change
global search_companies
from app.services.search import search_companies
pass # Removed dynamic import; import will be handled at the test level.

Copilot uses AI. Check for mistakes.
XAI_MODEL_L=grok-3-latest
XAI_MODEL_XL=grok-4-0709

# CSV_FOR_SPONSORSHIP
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

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

The comment 'CSV_FOR_SPONSORSHIP' doesn't match the actual environment variable name 'CSV_SPONSORSHIP'. Consider updating the comment to match: '# CSV_SPONSORSHIP'

Suggested change
# CSV_FOR_SPONSORSHIP
# CSV_SPONSORSHIP

Copilot uses AI. Check for mistakes.
@nikilok nikilok merged commit 0ca11a6 into main Jul 21, 2025
1 check passed
@nikilok nikilok deleted the feature/update-csv branch July 21, 2025 14:19
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.

2 participants