Skip to content

Commit

Permalink
Predicate modifier fix (#389)
Browse files Browse the repository at this point in the history
* Add `predicate_modifier` as blank column if absent while `remove_mappings`

* formatted

* fixed flake8 error

* Add predicate_modifier check wherever KEY_FEATURES are used.

* replaced previous logic

* fixed error

* mkdir sssom before copying into via workflow

* moved from makefile to workflow

* install dependencies

* removed poetry just installed black

* removed extra optional column
  • Loading branch information
hrshdhgd authored Jul 10, 2023
1 parent 810e69e commit 42b1cc8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/update_context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ jobs:
- name: Work around permission issue
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Install Black
run: |
pip install --upgrade pip
pip install black
- name: Update schema files
run: make all_schema

- name: Update sssom context
run: make deploy-dm
run: |
mkdir -p sssom
make deploy-dm
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
Expand Down
8 changes: 6 additions & 2 deletions src/sssom/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,20 @@ def clean_prefix_map(self, strict: bool = True) -> None:
# self.df = filter_out_prefixes(self.df, missing_prefixes)
self.prefix_map = new_prefixes

def remove_mappings(self, msdf: "MappingSetDataFrame"):
def remove_mappings(self, msdf: "MappingSetDataFrame") -> None:
"""Remove mappings in right msdf from left msdf.
:param msdf: MappingSetDataframe object to be removed from primary msdf object.
"""
merge_on = KEY_FEATURES.copy()
if self.df is not None and PREDICATE_MODIFIER not in self.df.columns:
merge_on.remove(PREDICATE_MODIFIER)

self.df = (
pd.merge(
self.df,
msdf.df,
on=KEY_FEATURES,
on=merge_on,
how="outer",
suffixes=("", "_2"),
indicator=True,
Expand Down

0 comments on commit 42b1cc8

Please sign in to comment.