Repository Analysis

fastapi/sqlmodel

SQL databases in Python, designed for simplicity, compatibility, and robustness.

4.2 Likely human-written View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of fastapi/sqlmodel, a Python project with 18,188 GitHub stars. SynthScan v2.0 examined 37,766 lines of code across 427 source files, recording 224 pattern matches distributed across 8 syntactic categories. The overall adjusted score of 4.2 places this repository in the Likely human-written band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

4.2
Adjusted Score
4.2
Raw Score
100%
Time Factor
2026-07-13
Last Push
18.2K
Stars
Python
Language
37.8K
Lines of Code
427
Files
224
Pattern Hits
2026-07-14
Scan Date
0.00
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 0MEDIUM 0LOW 224

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 224 distinct pattern matches across 8 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Unused Imports148 hits · 91 pts
SeverityFileLineSnippetContext
LOWtests/test_future_annotations.py1CODE
LOW…utorial/code_structure/tutorial002_py310/team_model.py6CODE
LOW…utorial/code_structure/tutorial002_py310/hero_model.py6CODE
LOWsqlmodel/__init__.py4CODE
LOWsqlmodel/__init__.py5CODE
LOWsqlmodel/__init__.py6CODE
LOWsqlmodel/__init__.py7CODE
LOWsqlmodel/__init__.py8CODE
LOWsqlmodel/__init__.py9CODE
LOWsqlmodel/__init__.py10CODE
LOWsqlmodel/__init__.py11CODE
LOWsqlmodel/__init__.py12CODE
LOWsqlmodel/__init__.py13CODE
LOWsqlmodel/__init__.py14CODE
LOWsqlmodel/__init__.py15CODE
LOWsqlmodel/__init__.py16CODE
LOWsqlmodel/__init__.py17CODE
LOWsqlmodel/__init__.py18CODE
LOWsqlmodel/__init__.py19CODE
LOWsqlmodel/__init__.py20CODE
LOWsqlmodel/__init__.py21CODE
LOWsqlmodel/__init__.py22CODE
LOWsqlmodel/__init__.py23CODE
LOWsqlmodel/__init__.py24CODE
LOWsqlmodel/__init__.py25CODE
LOWsqlmodel/__init__.py26CODE
LOWsqlmodel/__init__.py27CODE
LOWsqlmodel/__init__.py28CODE
LOWsqlmodel/__init__.py29CODE
LOWsqlmodel/__init__.py32CODE
LOWsqlmodel/__init__.py33CODE
LOWsqlmodel/__init__.py36CODE
LOWsqlmodel/__init__.py37CODE
LOWsqlmodel/__init__.py38CODE
LOWsqlmodel/__init__.py39CODE
LOWsqlmodel/__init__.py40CODE
LOWsqlmodel/__init__.py41CODE
LOWsqlmodel/__init__.py42CODE
LOWsqlmodel/__init__.py43CODE
LOWsqlmodel/__init__.py44CODE
LOWsqlmodel/__init__.py45CODE
LOWsqlmodel/__init__.py46CODE
LOWsqlmodel/__init__.py47CODE
LOWsqlmodel/__init__.py48CODE
LOWsqlmodel/__init__.py49CODE
LOWsqlmodel/__init__.py50CODE
LOWsqlmodel/__init__.py51CODE
LOWsqlmodel/__init__.py52CODE
LOWsqlmodel/__init__.py53CODE
LOWsqlmodel/__init__.py54CODE
LOWsqlmodel/__init__.py55CODE
LOWsqlmodel/__init__.py56CODE
LOWsqlmodel/__init__.py57CODE
LOWsqlmodel/__init__.py58CODE
LOWsqlmodel/__init__.py59CODE
LOWsqlmodel/__init__.py60CODE
LOWsqlmodel/__init__.py61CODE
LOWsqlmodel/__init__.py62CODE
LOWsqlmodel/__init__.py63CODE
LOWsqlmodel/__init__.py64CODE
88 more matches not shown…
Hyper-Verbose Identifiers57 hits · 52 pts
SeverityFileLineSnippetContext
LOWtests/conftest.py54def get_testing_print_function(CODE
LOWtests/test_future_annotations.py8def test_model_with_future_annotations(clear_sqlmodel):CODE
LOWtests/test_future_annotations.py36def test_model_with_string_annotations(clear_sqlmodel):CODE
LOWtests/test_prepare_release.py42def test_update_version_file_requires_newer_version() -> None:CODE
LOWtests/test_prepare_release.py49def test_update_release_notes() -> None:CODE
LOWtests/test_prepare_release.py90def test_update_release_notes_rejects_existing_version() -> None:STRING
LOWtests/test_prepare_release.py104def test_get_release_notes_body_with_dated_heading() -> None:STRING
LOWtests/test_prepare_release.py133def test_get_release_notes_body_with_plain_heading() -> None:STRING
LOWtests/test_prepare_release.py171def test_get_release_notes_body_requires_version_section() -> None:STRING
LOWtests/test_prepare_release.py178def test_get_release_notes_body_requires_non_empty_section() -> None:STRING
LOWtests/test_prepare_release.py194def test_cli_updates_configured_files(tmp_path: Path) -> None:STRING
LOWtests/test_prepare_release.py230def test_cli_accepts_env_vars(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:STRING
LOWtests/test_prepare_release.py250def test_cli_prints_current_version(tmp_path: Path) -> None:STRING
LOWtests/test_prepare_release.py268def test_cli_prints_release_notes(tmp_path: Path) -> None:STRING
LOWtests/test_deprecations.py13def test_deprecated_from_orm_inheritance():CODE
LOWtests/test_deprecations.py21def test_deprecated_parse_obj():CODE
LOWtests/test_nullable.py81def test_non_nullable_optional_field_with_no_default_set(clear_sqlmodel, caplog):CODE
LOWtests/test_nullable.py108def test_nullable_primary_key(clear_sqlmodel, caplog):CODE
LOWtests/test_ondelete_raises.py7def test_ondelete_requires_nullable(clear_sqlmodel: Any) -> None:CODE
LOWtests/test_ondelete_raises.py29def test_ondelete_requires_foreign_key(clear_sqlmodel: Any) -> None:CODE
LOWtests/test_aliases.py29def test_create_with_field_name(model: type[PydanticUser] | type[SQLModelUser]):CODE
LOWtests/test_aliases.py35def test_create_with_field_name_with_config(CODE
LOWtests/test_aliases.py57def test_create_with_both_prefers_alias(CODE
LOWtests/test_aliases.py65def test_dict_default_uses_field_names(CODE
LOWtests/test_aliases.py76def test_dict_by_alias_uses_aliases(CODE
LOWtests/test_aliases.py105def test_create_with_validation_alias(CODE
LOWtests/test_aliases.py113def test_serialize_with_serialization_alias(CODE
LOWtests/test_field_sa_relationship.py6def test_sa_relationship_no_args() -> None:CODE
LOWtests/test_field_sa_relationship.py30def test_sa_relationship_no_kwargs() -> None:CODE
LOWtests/test_field_sa_column.py8def test_sa_column_takes_precedence() -> None:CODE
LOWtests/test_field_sa_column.py20def test_sa_column_with_annotated_metadata() -> None:CODE
LOWtests/test_field_sa_column.py31def test_sa_column_no_sa_args() -> None:CODE
LOWtests/test_field_sa_column.py42def test_sa_column_no_sa_kargs() -> None:CODE
LOWtests/test_field_sa_column.py64def test_sa_column_no_primary_key() -> None:CODE
LOWtests/test_field_sa_column.py75def test_sa_column_no_nullable() -> None:CODE
LOWtests/test_field_sa_column.py86def test_sa_column_no_foreign_key() -> None:CODE
LOWtests/test_field_sa_column.py124def test_sa_column_no_ondelete() -> None:CODE
LOWtests/test_main.py9def test_should_allow_duplicate_row_if_unique_constraint_is_not_passed(clear_sqlmodel):CODE
LOWtests/test_main.py39def test_should_allow_duplicate_row_if_unique_constraint_is_false(clear_sqlmodel):CODE
LOWtests/test_main.py69def test_should_raise_exception_when_try_to_duplicate_row_if_unique_constraint_is_true(CODE
LOWtests/test_main.py96def test_sa_relationship_property(clear_sqlmodel):CODE
LOWtests/test_main.py130def test_composite_primary_key(clear_sqlmodel):CODE
LOWtests/test_main.py156def test_composite_primary_key_and_validator(clear_sqlmodel):CODE
LOWtests/test_main.py191def test_foreign_key_ondelete_with_annotated(clear_sqlmodel):CODE
LOWtests/test_annotated_uuid.py6def test_annotated_optional_types(clear_sqlmodel) -> None:CODE
LOWtests/test_instance_no_args.py6def test_allow_instantiation_without_arguments(clear_sqlmodel):CODE
LOWtests/test_instance_no_args.py26def test_not_allow_instantiation_without_arguments_if_not_table():CODE
LOWtests/test_pydantic/test_model_dump.py23def test_polymorphic_serialization(CODE
LOWscripts/docs.py150def generate_docs_src_versions_for_file(file_path: Path) -> None:STRING
LOWscripts/docs.py211def generate_docs_src_versions() -> None:STRING
LOW…i/app_testing/tutorial001_py310/test_extra_coverage.py31def test_update_hero_not_found(client: TestClient):CODE
LOW…i/app_testing/tutorial001_py310/test_extra_coverage.py36def test_delete_hero_not_found(client: TestClient):CODE
LOW…ial/fastapi/app_testing/tutorial001_py310/test_main.py43def test_create_hero_incomplete(client: TestClient):CODE
LOWsqlmodel/_compat.py94def init_pydantic_private_attrs(new_object: InstanceOrType["SQLModel"]) -> None:CODE
LOWsqlmodel/_compat.py174def get_sa_type_from_type_annotation(annotation: Any) -> Any:CODE
LOWsqlmodel/main.py217def _get_sqlmodel_field_metadata(field_info: Any) -> FieldInfoMetadata | None:CODE
LOWsqlmodel/main.py226def _get_sqlmodel_field_value(CODE
Deep Nesting8 hits · 8 pts
SeverityFileLineSnippetContext
LOWtests/conftest.py54CODE
LOWtests/conftest.py57CODE
LOWscripts/docs.py150CODE
LOWscripts/docs.py277CODE
LOWsqlmodel/_compat.py122CODE
LOWsqlmodel/_compat.py208CODE
LOWsqlmodel/main.py627CODE
LOWsqlmodel/main.py985CODE
AI Structural Patterns6 hits · 6 pts
SeverityFileLineSnippetContext
LOWtests/conftest.py51CODE
LOWsqlmodel/main.py237CODE
LOWsqlmodel/main.py280CODE
LOWsqlmodel/main.py332CODE
LOWsqlmodel/main.py365CODE
LOWsqlmodel/main.py890CODE
Over-Commented Block2 hits · 2 pts
SeverityFileLineSnippetContext
LOWtests/test_select_typing.py61 # assert type(hero_5[3]) in [int, type(None)]COMMENT
LOWsqlmodel/main.py821 # in the Pydantic model so that when SQLAlchemy sets attributes that areCOMMENT
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippetContext
LOWtests/test_fields_set.py9 email: str = "test@test.com"CODE
Modern Structural Boilerplate1 hit · 0 pts
SeverityFileLineSnippetContext
LOWscripts/docs.py253def update_docs_includes_py39_to_py310() -> None:STRING
Redundant / Tautological Comments1 hit · 0 pts
SeverityFileLineSnippetContext
LOWscripts/docs.py314 # Check if the _an counterpart (or non-_an counterpart) is referenced.STRING