Skip to content

Commit

Permalink
sort notification values
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbellini committed Apr 9, 2024
1 parent 1193fb1 commit 784e8f6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hooks/inlabs_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import re
from datetime import datetime, timedelta, date
import pandas as pd
import unicodedata
import pandas as pd
import html2text

from airflow.hooks.base import BaseHook
Expand Down Expand Up @@ -177,6 +177,9 @@ def transform_search_results(
"""

df = response.copy()
# `identifica` column is the publication title. If None
# can be a table or other text content that is not inside
# a publication.
df.dropna(subset=["identifica"], inplace=True)
df["pubname"] = df["pubname"].apply(self._rename_section)
df["identifica"] = df["identifica"].apply(self._remove_html_tags)
Expand Down Expand Up @@ -226,7 +229,9 @@ def transform_search_results(
{}
if df.empty
else self._group_to_dict(
df.sort_values(by="matches"), "matches", cols_output
df.sort_values(by=["matches", "section", "title"]),
"matches",
cols_output,
)
)

Expand Down

0 comments on commit 784e8f6

Please sign in to comment.