Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
cebf085
Begin draft
maxachis Oct 13, 2025
f9aa64b
Add logic for validating anonymous name suggestions
maxachis Dec 6, 2025
be468fc
Merge pull request #554 from Police-Data-Accessibility-Project/mc_434…
maxachis Dec 14, 2025
1015bdf
Remove special permission access for annotate endpoint
maxachis Dec 17, 2025
e7a6c46
Merge pull request #558 from Police-Data-Accessibility-Project/mc_ann…
maxachis Dec 17, 2025
a053d16
Remove special permission requirements
maxachis Dec 18, 2025
9460f52
Merge pull request #559 from Police-Data-Accessibility-Project/mc_ann…
maxachis Dec 18, 2025
749c2b5
Privilege manually-submitted URLs for annotation sorting
maxachis Dec 18, 2025
d53e1c0
Remove unused test setup parameter
maxachis Dec 18, 2025
6b569bc
Merge pull request #561 from Police-Data-Accessibility-Project/mc_560…
maxachis Dec 18, 2025
7240844
Rename annotation tables to consistent nomenclature patterns
maxachis Dec 18, 2025
b3600e9
Change organization of annotations.
maxachis Dec 19, 2025
7ab6638
Merge branch 'dev' into mc_551_suggestion_nomenclature
maxachis Dec 19, 2025
b33d4f3
Merge pull request #562 from Police-Data-Accessibility-Project/mc_551…
maxachis Dec 19, 2025
01049eb
Refactor query
maxachis Dec 20, 2025
41f8513
Merge pull request #563 from Police-Data-Accessibility-Project/mc_ann…
maxachis Dec 20, 2025
74a07a5
Add annotation migrate endpoint
maxachis Dec 20, 2025
7f6d93d
Merge pull request #564 from Police-Data-Accessibility-Project/mc_mig…
maxachis Dec 20, 2025
814e3b8
Add logic for handling conflicts
maxachis Dec 20, 2025
04552a8
Merge pull request #565 from Police-Data-Accessibility-Project/mc_mig…
maxachis Dec 20, 2025
a9486b5
Add logic for including anonymous annotation counts
maxachis Dec 22, 2025
8677b8a
Merge pull request #567 from Police-Data-Accessibility-Project/mc_506…
maxachis Dec 22, 2025
9ef70ce
Add logic for agency proposals
maxachis Dec 24, 2025
5ac9ec7
Merge pull request #568 from Police-Data-Accessibility-Project/mc_506…
maxachis Dec 24, 2025
4acc9f1
Add Followed Locations Sync Task
maxachis Dec 25, 2025
2749469
Merge pull request #571 from Police-Data-Accessibility-Project/mc_435…
maxachis Dec 25, 2025
2607ef3
Refine sorting
maxachis Dec 26, 2025
c118df2
Merge pull request #572 from Police-Data-Accessibility-Project/mc_435…
maxachis Dec 26, 2025
82e87e8
Update permissions
maxachis Dec 26, 2025
f26b1ea
Clean up and refactor
maxachis Dec 29, 2025
d060983
Merge pull request #575 from Police-Data-Accessibility-Project/mc_767…
maxachis Dec 29, 2025
78923c4
Add agency proposal edit logic
maxachis Dec 29, 2025
7c85ad0
Merge pull request #576 from Police-Data-Accessibility-Project/mc_506…
maxachis Dec 29, 2025
ff9bf38
Fix attribute bugs in agency queries
maxachis Dec 30, 2025
bc1531e
Begin draft
maxachis Dec 31, 2025
d3f8041
Continue draft
maxachis Dec 31, 2025
650580a
Remove URLStatus
maxachis Jan 1, 2026
1067302
Merge pull request #577 from Police-Data-Accessibility-Project/mc_393…
maxachis Jan 1, 2026
3a344bd
Tighten record type requirement for prerequisite
maxachis Jan 1, 2026
ac527a6
Merge pull request #579 from Police-Data-Accessibility-Project/mc_578…
maxachis Jan 1, 2026
ffd9d66
Merge remote-tracking branch 'origin/dev' into mc_update_permissions
maxachis Jan 4, 2026
f380eb5
Fix broken import
maxachis Jan 4, 2026
ae77cb4
Merge pull request #573 from Police-Data-Accessibility-Project/mc_upd…
maxachis Jan 4, 2026
c068e3f
Merge branch 'dev' into mc_484_eliminate_contact_info_and_agency_meta…
maxachis Jan 4, 2026
cb11983
Merge pull request #486 from Police-Data-Accessibility-Project/mc_484…
maxachis Jan 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions ENV.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Note that some tasks/subtasks are themselves enabled by other tasks.
| `DS_APP_SYNC_META_URL_ADD_TASK_FLAG` | Adds new meta URLs to the Data Sources App|
| `DS_APP_SYNC_META_URL_UPDATE_TASK_FLAG` | Updates existing meta URLs in the Data Sources App|
| `DS_APP_SYNC_META_URL_DELETE_TASK_FLAG` | Deletes meta URLs in the Data Sources App|
| `DS_APP_SYNC_USER_FOLLOWS_GET_TASK_FLAG` | Gets user follows from the Data Sources App|
| `INTEGRITY_MONITOR_TASK_FLAG` | Runs integrity checks. |

### URL Task Flags
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""Create anonymous_annotation_name

Revision ID: dfb64594049f
Revises: 1d3398f9cd8a
Create Date: 2025-12-05 17:21:35.134935

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import UUID

from src.util.alembic_helpers import created_at_column

# revision identifiers, used by Alembic.
revision: str = 'dfb64594049f'
down_revision: Union[str, None] = '1d3398f9cd8a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:

Check warning on line 23 in alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py#L23 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py:23:1: D103 Missing docstring in public function
op.create_table(
"link__anonymous_sessions__name_suggestions",
sa.Column(
"session_id",
UUID,
sa.ForeignKey("anonymous_sessions.id"),
nullable=False
),
sa.Column(
"suggestion_id",
sa.Integer(),
sa.ForeignKey("url_name_suggestions.id"),
nullable=False,
),
created_at_column(),
sa.PrimaryKeyConstraint(
"session_id",
"suggestion_id"
)
)


def downgrade() -> None:

Check warning on line 46 in alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py#L46 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_05_1721-dfb64594049f_create_anonymous_annotation_name.py:46:1: D103 Missing docstring in public function
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""Rename suggestion tables to consistent nomenclature

Revision ID: 9292faed37fd
Revises: dfb64594049f
Create Date: 2025-12-18 09:51:20.074946

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

Check warning on line 11 in alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py#L11 <401>

'sqlalchemy as sa' imported but unused
Raw output
./alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py:11:1: F401 'sqlalchemy as sa' imported but unused


# revision identifiers, used by Alembic.
revision: str = '9292faed37fd'
down_revision: Union[str, None] = 'dfb64594049f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

OLD_NEW_TABLE_MAPPING = {
# Anonymous Suggestions
"anonymous_annotation_agency": "annotation__agency__anon",
"anonymous_annotation_location": "annotation__location__anon",
"anonymous_annotation_record_type": "annotation__record_type__anon",
"anonymous_annotation_url_type": "annotation__url_type__anon",
# User Suggestions
"user_url_agency_suggestions": "annotation__agency__user",
"user_location_suggestions": "annotation__location__user",
"user_record_type_suggestions": "annotation__record_type__user",
"user_url_type_suggestions": "annotation__url_type__user",
# Auto suggestions
"auto_location_id_subtasks": "annotation__location__auto__subtasks",
"location_id_subtask_suggestions": "annotation__location__auto__suggestions",
"url_auto_agency_id_subtasks": "annotation__agency__auto__subtasks",
"agency_id_subtask_suggestions": "annotation__agency__auto__suggestions",
"auto_record_type_suggestions": "annotation__record_type__auto",
"auto_relevant_suggestions": "annotation__url_type__auto",
# Name suggestions
"url_name_suggestions": "annotation__name__suggestions",
"link__anonymous_sessions__name_suggestions": "annotation__name__anon__endorsements",
"link_user_name_suggestions": "annotation__name__user__endorsements",
}

def upgrade() -> None:

Check warning on line 44 in alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py#L44 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py:44:1: D103 Missing docstring in public function
for old_table_name, new_table_name in OLD_NEW_TABLE_MAPPING.items():
op.rename_table(
old_table_name=old_table_name,
new_table_name=new_table_name
)


def downgrade() -> None:

Check warning on line 52 in alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py#L52 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_18_0951-9292faed37fd_rename_suggestion_tables_to_consistent_.py:52:1: D103 Missing docstring in public function
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
"""Add pending agencies tables

Revision ID: 30ee666f15d1
Revises: 9292faed37fd
Create Date: 2025-12-21 19:57:58.199838

Design notes:

After debating it internally, I elected to have a separate pending agencies table,
rather than adding an `approval status` column to the agencies table.

This is for a few reasons:
1. Many existing queries and models rely on the current agency setup,
and would need to be retrofitted in order to filter
approved and unapproved agencies.
2. Some existing links, such as between agencies and batches, between agencies and URLs,
or agency annotations for URLs, would not make sense for pending agencies,
and would be difficult to prevent in the database.

This setup does, however, make it more difficult to check for duplicates between
existing agencies and pending agencies. However, I concluded it was better for
pending agencies to be negatively affected by these design choices than
for existing agencies to be affected by the above design choices.

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

from src.util.alembic_helpers import id_column, created_at_column, enum_column, agency_id_column

Check warning on line 31 in alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py#L31 <401>

'src.util.alembic_helpers.agency_id_column' imported but unused
Raw output
./alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py:31:1: F401 'src.util.alembic_helpers.agency_id_column' imported but unused

# revision identifiers, used by Alembic.
revision: str = '30ee666f15d1'
down_revision: Union[str, None] = '9292faed37fd'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None




def upgrade() -> None:

Check warning on line 42 in alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py#L42 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py:42:1: D103 Missing docstring in public function

Check failure on line 42 in alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py#L42 <303>

too many blank lines (4)
Raw output
./alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py:42:1: E303 too many blank lines (4)
_create_proposed_agency_table()
_create_proposed_agency_location_table()
_create_proposed_agency_decision_info_table()

def _create_proposed_agency_decision_info_table():
op.create_table(
"proposal__agencies__decision_info",
sa.Column("proposal_agency_id", sa.Integer(), sa.ForeignKey("proposal__agencies.id"), nullable=False),
sa.Column("deciding_user_id", sa.Integer),
sa.Column("rejection_reason", sa.String(), nullable=True),
created_at_column(),
sa.PrimaryKeyConstraint("proposal_agency_id")
)


def _create_proposed_agency_table():
op.execute("CREATE TYPE proposal_status_enum AS ENUM ('pending', 'approved', 'rejected');")

op.create_table(
"proposal__agencies",
id_column(),
sa.Column("name", sa.String(), nullable=False),
enum_column(
column_name="agency_type",
enum_name="agency_type_enum",
),
enum_column(
column_name="jurisdiction_type",
enum_name="jurisdiction_type_enum"
),
sa.Column("proposing_user_id", sa.Integer(), nullable=True),
sa.Column(
"promoted_agency_id",
sa.Integer(),
sa.ForeignKey(
"agencies.id"
)
),
enum_column(
column_name="proposal_status",
enum_name="proposal_status_enum",
),
created_at_column(),
sa.CheckConstraint(
"promoted_agency_id IS NULL OR proposal_status = 'pending'",
name="ck_agency_id_or_proposal_status"
)
)

def _create_proposed_agency_location_table():
op.create_table(
"proposal__link__agencies__locations",
sa.Column(
"proposal_agency_id",
sa.Integer(),
sa.ForeignKey("proposal__agencies.id"),
nullable=False,
),
sa.Column(
"location_id",
sa.Integer(),
sa.ForeignKey("locations.id"),
nullable=False
),
created_at_column(),
sa.PrimaryKeyConstraint("proposal_agency_id", "location_id")
)

def downgrade() -> None:

Check warning on line 111 in alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py#L111 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_21_1957-30ee666f15d1_add_pending_agencies_tables.py:111:1: D103 Missing docstring in public function
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Add link__locations__user_follows table

Revision ID: e88e4e962dc7
Revises: 30ee666f15d1
Create Date: 2025-12-24 18:54:38.897466

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

from src.util.alembic_helpers import add_enum_value, location_id_column, user_id_column, created_at_column

# revision identifiers, used by Alembic.
revision: str = 'e88e4e962dc7'
down_revision: Union[str, None] = '30ee666f15d1'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

def upgrade() -> None:

Check warning on line 21 in alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py#L21 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py:21:1: D103 Missing docstring in public function
_add_link_locations_user_follows_table()
_add_follows_sync_task()

def _add_link_locations_user_follows_table():
op.create_table(
"link__locations__user_follows",
location_id_column(),
user_id_column(),
created_at_column(),
sa.PrimaryKeyConstraint("location_id", "user_id"),
)


def _add_follows_sync_task():
add_enum_value(
enum_name="task_type",
enum_value="Sync User Follows Get"
)

def downgrade() -> None:

Check warning on line 41 in alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py#L41 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_12_24_1854-e88e4e962dc7_add_link__locations__user_follows_table.py:41:1: D103 Missing docstring in public function
pass
Loading