Skip to content

Fix Issue #39: Filter restricted data in wfcatalog_client#46

Merged
NikolaosSokos merged 6 commits intoEIDA:masterfrom
NikolaosSokos:fix/issue-39
Jan 26, 2026
Merged

Fix Issue #39: Filter restricted data in wfcatalog_client#46
NikolaosSokos merged 6 commits intoEIDA:masterfrom
NikolaosSokos:fix/issue-39

Conversation

@NikolaosSokos
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

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 adds functionality to filter restricted data from the WFCatalog client based on a new includerestricted parameter. When set to False (the default), the system now filters out restricted data segments before returning results to the user.

Key changes:

  • Added include_restricted parameter to _apply_restricted_bit function to control filtering behavior
  • Modified mongo_request to pass the includerestricted parameter from request to the filtering function
  • Implemented logic to skip segments with restr == "RESTRICTED" when include_restricted is False

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +145 to +146
if segment["restr"] == "RESTRICTED" and not include_restricted:
continue
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

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

The new filtering logic for restricted data lacks test coverage. Consider adding tests that verify:

  1. When include_restricted is False, restricted segments are excluded from results
  2. When include_restricted is True, all segments (including restricted) are returned
  3. The filtering correctly handles segments where restr is "RESTRICTED" vs other statuses

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

NikolaosSokos and others added 4 commits December 22, 2025 16:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

apps/wfcatalog_client.py:162

  • The code accesses segment["restr"] at line 162, but this field is only explicitly set for segments in RESTRICTED_INVENTORY._restricted_seedIDs (line 147). For segments in _known_seedIDs but not in _restricted_seedIDs, the field is not set by this code. While the MongoDB projection includes "restr": 1 (line 24), if this field doesn't exist in some database documents, accessing it will cause a KeyError. Consider using segment.get("restr", None) at line 162 or explicitly setting segment["restr"] = None for segments not in _restricted_seedIDs to handle missing fields gracefully.
        if sid in RESTRICTED_INVENTORY._restricted_seedIDs:
            segment["restr"] = _get_restricted_status(segment)
            if segment["restr"] in ["RESTRICTED", "PARTIAL"] and not include_restricted:
                continue

        results.append(
            [
                segment["net"],
                segment["sta"],
                segment["loc"],
                segment["cha"],
                segment["qlt"],
                segment["srate"],
                segment["ts"],
                segment["te"],
                segment["created"],
                segment["restr"],

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NikolaosSokos NikolaosSokos merged commit 0f5f99c into EIDA:master Jan 26, 2026
6 checks passed
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