Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ENV.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Agency ID Subtasks are collectively disabled by the `URL_AGENCY_IDENTIFICATION_T
| `AGENCY_ID_NLP_LOCATION_MATCH_FLAG` | Enables the NLP location match subtask for agency identification. |
| `AGENCY_ID_CKAN_FLAG` | Enables the CKAN subtask for agency identification. |
| `AGENCY_ID_MUCKROCK_FLAG` | Enables the MuckRock subtask for agency identification. |
| `AGENCY_ID_BATCH_LINK_FLAG` | Enables the Batch Link subtask for agency identification. |


### Location ID Subtasks
Expand All @@ -111,6 +112,7 @@ Location ID Subtasks are collectively disabled by the `URL_LOCATION_IDENTIFICATI
| Flag | Description |
|---------------------------------------|---------------------------------------------------------------------|
| `LOCATION_ID_NLP_LOCATION_MATCH_FLAG` | Enables the NLP location match subtask for location identification. |
| `LOCATION_ID_BATCH_LINK_FLAG` | Enables the Batch Link subtask for location identification. |


## Foreign Data Wrapper (FDW)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Add batch link subtasks

Revision ID: 8b2adc95c5d7
Revises: 7c4049508bfc
Create Date: 2025-10-11 14:38:01.874040

"""
from typing import Sequence, Union

from alembic import op

Check warning on line 10 in alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py#L10 <401>

'alembic.op' imported but unused
Raw output
./alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py:10:1: F401 'alembic.op' imported but unused
import sqlalchemy as sa

Check warning on line 11 in alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py#L11 <401>

'sqlalchemy as sa' imported but unused
Raw output
./alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py:11:1: F401 'sqlalchemy as sa' imported but unused

from src.util.alembic_helpers import add_enum_value

# revision identifiers, used by Alembic.
revision: str = '8b2adc95c5d7'
down_revision: Union[str, None] = '7c4049508bfc'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:

Check warning on line 22 in alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py#L22 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py:22:1: D103 Missing docstring in public function
add_enum_value(
enum_name="agency_auto_suggestion_method",
enum_value="batch_link"
)
add_enum_value(
enum_name="auto_location_id_subtask_type",
enum_value="batch_link"
)


def downgrade() -> None:

Check warning on line 33 in alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py#L33 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_10_11_1438-8b2adc95c5d7_add_batch_link_subtasks.py:33:1: D103 Missing docstring in public function
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
AutoAgencyIDSubtaskType.HOMEPAGE_MATCH: "AGENCY_ID_HOMEPAGE_MATCH_FLAG",
AutoAgencyIDSubtaskType.NLP_LOCATION_MATCH: "AGENCY_ID_NLP_LOCATION_MATCH_FLAG",
AutoAgencyIDSubtaskType.CKAN: "AGENCY_ID_CKAN_FLAG",
AutoAgencyIDSubtaskType.MUCKROCK: "AGENCY_ID_MUCKROCK_FLAG"
AutoAgencyIDSubtaskType.MUCKROCK: "AGENCY_ID_MUCKROCK_FLAG",
AutoAgencyIDSubtaskType.BATCH_LINK: "AGENCY_ID_BATCH_LINK_FLAG"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from src.core.tasks.url.operators.agency_identification.subtasks.impl.batch_link.params import \

Check warning on line 1 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py:1:1: D100 Missing docstring in public module
AgencyBatchLinkSubtaskParams
from src.core.tasks.url.operators.agency_identification.subtasks.impl.batch_link.query import \
GetLocationBatchLinkSubtaskParamsQueryBuilder
from src.core.tasks.url.operators.agency_identification.subtasks.models.subtask import AutoAgencyIDSubtaskData
from src.core.tasks.url.operators.agency_identification.subtasks.models.suggestion import AgencySuggestion
from src.core.tasks.url.operators.agency_identification.subtasks.templates.subtask import AgencyIDSubtaskOperatorBase
from src.db.client.async_ import AsyncDatabaseClient
from src.db.models.impl.url.suggestion.agency.subtask.enum import AutoAgencyIDSubtaskType
from src.db.models.impl.url.suggestion.agency.subtask.pydantic import URLAutoAgencyIDSubtaskPydantic


class AgencyBatchLinkSubtaskOperator(AgencyIDSubtaskOperatorBase):

Check warning on line 13 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py#L13 <101>

Missing docstring in public class
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py:13:1: D101 Missing docstring in public class

def __init__(

Check warning on line 15 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py#L15 <107>

Missing docstring in __init__
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py:15:1: D107 Missing docstring in __init__
self,
adb_client: AsyncDatabaseClient,
task_id: int
):
super().__init__(adb_client=adb_client, task_id=task_id)

async def inner_logic(self) -> None:

Check warning on line 22 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py#L22 <102>

Missing docstring in public method
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py:22:1: D102 Missing docstring in public method
params: list[AgencyBatchLinkSubtaskParams] = await self._get_params()
self.linked_urls = [param.url_id for param in params]
subtask_data_list: list[AutoAgencyIDSubtaskData] = []
for param in params:
subtask_data: AutoAgencyIDSubtaskData = AutoAgencyIDSubtaskData(
pydantic_model=URLAutoAgencyIDSubtaskPydantic(
task_id=self.task_id,
url_id=param.url_id,
type=AutoAgencyIDSubtaskType.BATCH_LINK,
agencies_found=True,
),
suggestions=[
AgencySuggestion(
agency_id=param.agency_id,
confidence=80,
)
],
)
subtask_data_list.append(subtask_data)

await self._upload_subtask_data(subtask_data_list)

async def _get_params(self) -> list[AgencyBatchLinkSubtaskParams]:
return await self.adb_client.run_query_builder(
GetLocationBatchLinkSubtaskParamsQueryBuilder()
)

Check warning on line 48 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py#L48 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/core.py:48:10: W292 no newline at end of file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from pydantic import BaseModel

Check warning on line 1 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py:1:1: D100 Missing docstring in public module


class AgencyBatchLinkSubtaskParams(BaseModel):

Check warning on line 4 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py#L4 <101>

Missing docstring in public class
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py:4:1: D101 Missing docstring in public class
url_id: int
agency_id: int

Check warning on line 6 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py#L6 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/params.py:6:19: W292 no newline at end of file
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from typing import Sequence

Check warning on line 1 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py:1:1: D100 Missing docstring in public module

from sqlalchemy import select, RowMapping
from sqlalchemy.ext.asyncio import AsyncSession

from src.core.tasks.url.operators.agency_identification.subtasks.impl.batch_link.params import \
AgencyBatchLinkSubtaskParams
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.eligible import \
EligibleContainer
from src.db.models.impl.link.agency_batch.sqlalchemy import LinkAgencyBatch
from src.db.models.impl.link.batch_url.sqlalchemy import LinkBatchURL
from src.db.queries.base.builder import QueryBuilderBase
from src.db.helpers.session import session_helper as sh

class GetLocationBatchLinkSubtaskParamsQueryBuilder(QueryBuilderBase):

Check warning on line 15 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py#L15 <101>

Missing docstring in public class
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py:15:1: D101 Missing docstring in public class

async def run(self, session: AsyncSession) -> list[AgencyBatchLinkSubtaskParams]:

Check warning on line 17 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py#L17 <102>

Missing docstring in public method
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py:17:1: D102 Missing docstring in public method
container = EligibleContainer()
query = (
select(
container.url_id,
LinkAgencyBatch.agency_id,
)
.select_from(container.cte)
.join(
LinkBatchURL,
LinkBatchURL.url_id == container.url_id,
)
.join(
LinkAgencyBatch,
LinkAgencyBatch.batch_id == LinkBatchURL.batch_id,
)
.where(
container.batch_link,
)
.limit(500)
)
results: Sequence[RowMapping] = await sh.mappings(session, query=query)
return [
AgencyBatchLinkSubtaskParams(
url_id=mapping["id"],
agency_id=mapping["agency_id"],
)
for mapping in results
]

Check warning on line 45 in src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py#L45 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/impl/batch_link/query.py:45:10: W292 no newline at end of file
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
from sqlalchemy import select, RowMapping
from sqlalchemy.ext.asyncio import AsyncSession

from src.collectors.enums import CollectorType
from src.core.tasks.url.operators.agency_identification.subtasks.impl.ckan_.params import CKANAgencyIDSubtaskParams
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.eligible import \
EligibleContainer
from src.db.helpers.session import session_helper as sh
from src.db.models.impl.batch.sqlalchemy import Batch
from src.db.models.impl.link.batch_url.sqlalchemy import LinkBatchURL
from src.db.models.impl.url.core.sqlalchemy import URL
from src.db.queries.base.builder import QueryBuilderBase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from src.collectors.impl.muckrock.api_interface.core import MuckrockAPIInterface
from src.core.tasks.url.operators.agency_identification.subtasks.impl.batch_link.core import \
AgencyBatchLinkSubtaskOperator
from src.core.tasks.url.operators.agency_identification.subtasks.impl.ckan_.core import CKANAgencyIDSubtaskOperator
from src.core.tasks.url.operators.agency_identification.subtasks.impl.homepage_match_.core import \
HomepageMatchSubtaskOperator
Expand Down Expand Up @@ -52,6 +54,15 @@ def _load_nlp_location_match_subtask(self, task_id: int) -> NLPLocationMatchSubt
adb_client=self.adb_client,
)

def _load_batch_link_subtask(
self,
task_id: int
) -> AgencyBatchLinkSubtaskOperator:
return AgencyBatchLinkSubtaskOperator(
task_id=task_id,
adb_client=self.adb_client,
)


async def load_subtask(
self,
Expand All @@ -68,4 +79,6 @@ async def load_subtask(
return self._load_nlp_location_match_subtask(task_id)
case AutoAgencyIDSubtaskType.HOMEPAGE_MATCH:
return self._load_homepage_match_subtask(task_id)
case AutoAgencyIDSubtaskType.BATCH_LINK:
return self._load_batch_link_subtask(task_id)
raise ValueError(f"Unknown subtask type: {subtask_type}")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
AutoAgencyIDSubtaskType.CKAN,
AutoAgencyIDSubtaskType.MUCKROCK,
AutoAgencyIDSubtaskType.HOMEPAGE_MATCH,
AutoAgencyIDSubtaskType.NLP_LOCATION_MATCH
AutoAgencyIDSubtaskType.NLP_LOCATION_MATCH,
AutoAgencyIDSubtaskType.BATCH_LINK
]

SUBTASK_HIERARCHY_MAPPING: dict[AutoAgencyIDSubtaskType, int] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
HIGH_CONFIDENCE_ANNOTATIONS_EXISTS_CONTAINER
from src.core.tasks.url.operators._shared.ctes.validated import \
VALIDATED_EXISTS_CONTAINER
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.subtask.impl.batch_link import \
BATCH_LINK_SUBTASK_CONTAINER
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.subtask.impl.ckan import \
CKAN_SUBTASK_CONTAINER
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.subtask.impl.homepage import \
Expand All @@ -24,6 +26,7 @@
MUCKROCK_SUBTASK_CONTAINER.eligible_query.label("muckrock"),
HOMEPAGE_SUBTASK_CONTAINER.eligible_query.label("homepage"),
NLP_LOCATION_CONTAINER.eligible_query.label("nlp_location"),
BATCH_LINK_SUBTASK_CONTAINER.eligible_query.label("batch_link"),
)
.where(
HIGH_CONFIDENCE_ANNOTATIONS_EXISTS_CONTAINER.not_exists_query,
Expand All @@ -44,6 +47,10 @@
def ckan(self) -> Column[bool]:
return self._cte.c['ckan']

@property
def batch_link(self) -> Column[bool]:

Check warning on line 51 in src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/eligible.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/eligible.py#L51 <102>

Missing docstring in public method
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/eligible.py:51:1: D102 Missing docstring in public method
return self._cte.c['batch_link']

@property
def muckrock(self) -> Column[bool]:
return self._cte.c['muckrock']
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from sqlalchemy import select

Check warning on line 1 in src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py:1:1: D100 Missing docstring in public module

from src.core.tasks.url.operators._shared.container.subtask.eligible import URLsSubtaskEligibleCTEContainer
from src.core.tasks.url.operators.agency_identification.subtasks.queries.survey.queries.ctes.subtask.helpers import \
get_exists_subtask_query
from src.db.models.impl.link.agency_batch.sqlalchemy import LinkAgencyBatch
from src.db.models.impl.link.batch_url.sqlalchemy import LinkBatchURL
from src.db.models.impl.url.core.sqlalchemy import URL
from src.db.models.impl.url.suggestion.agency.subtask.enum import AutoAgencyIDSubtaskType

cte = (
select(
URL.id,
get_exists_subtask_query(
AutoAgencyIDSubtaskType.BATCH_LINK,
)
)
.join(
LinkBatchURL,
LinkBatchURL.url_id == URL.id,
)
.join(
LinkAgencyBatch,
LinkAgencyBatch.batch_id == LinkBatchURL.batch_id,
)
.cte("batch_link_eligible")
)

BATCH_LINK_SUBTASK_CONTAINER = URLsSubtaskEligibleCTEContainer(
cte,
)

Check warning on line 31 in src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py#L31 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/agency_identification/subtasks/queries/survey/queries/ctes/subtask/impl/batch_link.py:31:2: W292 no newline at end of file
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ def sum_count(col: ColumnElement[bool], subtask_type: AutoAgencyIDSubtaskType) -
sum_count(container.muckrock, AutoAgencyIDSubtaskType.MUCKROCK),
sum_count(container.homepage, AutoAgencyIDSubtaskType.HOMEPAGE_MATCH),
sum_count(container.nlp_location, AutoAgencyIDSubtaskType.NLP_LOCATION_MATCH),
sum_count(container.batch_link, AutoAgencyIDSubtaskType.BATCH_LINK)
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

SUBTASK_TO_ENV_FLAG: dict[LocationIDSubtaskType, str] = {
LocationIDSubtaskType.NLP_LOCATION_FREQUENCY: "LOCATION_ID_NLP_LOCATION_MATCH_FLAG",
LocationIDSubtaskType.BATCH_LINK: "LOCATION_ID_BATCH_LINK_FLAG",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from src.core.tasks.url.operators.location_id.subtasks.impl.batch_link.inputs import LocationBatchLinkInput

Check warning on line 1 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:1:1: D100 Missing docstring in public module
from src.core.tasks.url.operators.location_id.subtasks.impl.batch_link.query import GetLocationBatchLinkQueryBuilder
from src.core.tasks.url.operators.location_id.subtasks.impl.nlp_location_freq.constants import ITERATIONS_PER_SUBTASK
from src.core.tasks.url.operators.location_id.subtasks.models.subtask import AutoLocationIDSubtaskData
from src.core.tasks.url.operators.location_id.subtasks.models.suggestion import LocationSuggestion
from src.core.tasks.url.operators.location_id.subtasks.templates.subtask import LocationIDSubtaskOperatorBase
from src.db.client.async_ import AsyncDatabaseClient
from src.db.models.impl.url.suggestion.location.auto.subtask.enums import LocationIDSubtaskType
from src.db.models.impl.url.suggestion.location.auto.subtask.pydantic import AutoLocationIDSubtaskPydantic


class LocationBatchLinkSubtaskOperator(LocationIDSubtaskOperatorBase):

Check warning on line 12 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L12 <101>

Missing docstring in public class
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:12:1: D101 Missing docstring in public class

def __init__(

Check warning on line 14 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L14 <107>

Missing docstring in __init__
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:14:1: D107 Missing docstring in __init__
self,
task_id: int,
adb_client: AsyncDatabaseClient,
):
super().__init__(adb_client=adb_client, task_id=task_id)

async def inner_logic(self) -> None:

Check warning on line 21 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L21 <102>

Missing docstring in public method
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:21:1: D102 Missing docstring in public method
for iteration in range(ITERATIONS_PER_SUBTASK):
inputs: list[LocationBatchLinkInput] = await self._get_from_db()
if len(inputs) == 0:
break
await self.run_subtask_iteration(inputs)

async def run_subtask_iteration(

Check warning on line 28 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L28 <102>

Missing docstring in public method
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:28:1: D102 Missing docstring in public method
self,
inputs: list[LocationBatchLinkInput]
) -> None:
self.linked_urls.extend([input_.url_id for input_ in inputs])
subtask_data_list: list[AutoLocationIDSubtaskData] = []
for input_ in inputs:
subtask_data_list.append(
AutoLocationIDSubtaskData(
pydantic_model=AutoLocationIDSubtaskPydantic(
url_id=input_.url_id,
task_id=self.task_id,
locations_found=True,
type=LocationIDSubtaskType.BATCH_LINK,
),
suggestions=[
LocationSuggestion(
location_id=input_.location_id,
confidence=80,
)
]
)
)

await self._upload_subtask_data(subtask_data_list)

async def _get_from_db(self) -> list[LocationBatchLinkInput]:
query = GetLocationBatchLinkQueryBuilder()
return await self.adb_client.run_query_builder(query)

Check warning on line 56 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py#L56 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/core.py:56:62: W292 no newline at end of file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from pydantic import BaseModel

Check warning on line 1 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py#L1 <100>

Missing docstring in public module
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py:1:1: D100 Missing docstring in public module


class LocationBatchLinkInput(BaseModel):

Check warning on line 4 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py#L4 <101>

Missing docstring in public class
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py:4:1: D101 Missing docstring in public class
location_id: int
url_id: int

Check warning on line 6 in src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py#L6 <292>

no newline at end of file
Raw output
./src/core/tasks/url/operators/location_id/subtasks/impl/batch_link/inputs.py:6:16: W292 no newline at end of file
Loading