Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainOfHacks committed Feb 29, 2024
1 parent 0a6b13e commit a351f2a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dags/eforms_notices/fetch_eform_notices_by_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
VALIDATE_FETCHED_NOTICES_TASK_ID = "validate_fetched_notices"


@dag(default_args=DEFAULT_DAG_ARGUMENTS, schedule_interval=None,
@dag(max_active_runs=1, concurrency=1, default_args=DEFAULT_DAG_ARGUMENTS, schedule_interval=None,
catchup=False, tags=['selector', 'daily-fetch'])
def fetch_and_index_eforms_notices_by_date():
@task
Expand All @@ -38,11 +38,11 @@ def fetch_and_index_eforms_notices_by_date():
def fetch_by_date_notice_from_ted():

date_wildcard = get_dag_param(key=WILD_CARD_DAG_KEY)
# query = f"""TD NOT IN (C E G I D P M Q O R 0 1 2 3 4 5 6 7 8 9 B S Y V F A H J K) AND
# notice-subtype IN (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24) AND FT~"eforms-sdk-" AND
# PD={date_wildcard}
# """
query = f"PD={date_wildcard}"
query = f"""TD NOT IN (C E G I D P M Q O R 0 1 2 3 4 5 6 7 8 9 B S Y V F A H J K) AND
notice-subtype IN (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24) AND FT~"eforms-sdk-" AND
PD={date_wildcard}
"""

notice_ids = notice_fetcher_by_query_pipeline(query=query)
if not notice_ids:
log_error("No notices has been fetched!")
Expand Down
15 changes: 15 additions & 0 deletions tests/e2e/notice_fetcher/test_notice_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ def test_notice_fetcher_by_identifier(notice_repository, ted_document_search):
assert notice.status == NoticeStatus.RAW


def test_notice_fetcher_by_search_eforms_query(notice_repository, ted_document_search):
query = f""" TD NOT IN (C E G I D P M Q O R 0 1 2 3 4 5 6 7 8 9 B S Y V F A H J K) AND
notice-subtype IN (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24) AND FT~"eforms-sdk-" AND
PD=20240223*
"""
ted_api_query = {"query": query}

NoticeFetcher(notice_repository=notice_repository, ted_api_adapter=ted_document_search).fetch_notices_by_query(
query=ted_api_query)
notices = list(notice_repository.list())
assert isinstance(notices, list)
assert len(notices) > 1
assert isinstance(notices[0], Notice)


def test_notice_fetcher_by_search_query(notice_repository, ted_document_search):
query = {"query": "ND=67623-2022"}

Expand Down

0 comments on commit a351f2a

Please sign in to comment.