Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(crud and models) #99

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 9 additions & 10 deletions genotype_api/api/endpoints/analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
from fastapi import APIRouter, Depends, status, Query, UploadFile, File
from fastapi.responses import JSONResponse

from genotype_api.crud.analyses import (
get_analysis,
check_analyses_objects,
create_analysis,
)
from genotype_api.crud.samples import (
create_analyses_sample_objects,
refresh_sample_status,
)
from genotype_api.database.crud.read import get_analysis, check_analyses_objects
from genotype_api.database.crud.create import create_analysis, create_analyses_sample_objects
from genotype_api.database.crud.update import refresh_sample_status
from genotype_api.database import get_session
from genotype_api.file_parsing.files import check_file
from genotype_api.models import Analysis, AnalysisRead, AnalysisReadWithGenotype, User
from genotype_api.database.models.models import (
Analysis,
AnalysisRead,
User,
AnalysisReadWithGenotype,
)
from sqlmodel import Session, select

from genotype_api.security import get_active_user
Expand Down
21 changes: 9 additions & 12 deletions genotype_api/api/endpoints/plates.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,23 @@
from sqlalchemy import desc, asc
from sqlmodel import Session, select

from genotype_api.crud.analyses import (
from genotype_api.database.crud.read import (
get_analyses_from_plate,
get_plate,
get_user_by_email,
check_analyses_objects,
)
from genotype_api.crud.samples import (
create_analyses_sample_objects,
refresh_sample_status,
)
from genotype_api.crud.plates import create_plate, get_plate
from genotype_api.crud.users import get_user_by_email
from genotype_api.database.crud.update import refresh_sample_status
from genotype_api.database.crud.create import create_plate, create_analyses_sample_objects
from genotype_api.database import get_session
from genotype_api.file_parsing.excel import GenotypeAnalysis
from genotype_api.file_parsing.files import check_file
from genotype_api.models import (
Plate,
PlateReadWithAnalyses,
from genotype_api.database.models.models import (
Analysis,
PlateCreate,
User,
PlateRead,
Plate,
PlateCreate,
PlateReadWithAnalyses,
PlateReadWithAnalysisDetail,
PlateReadWithAnalysisDetailSingle,
)
Expand Down
23 changes: 12 additions & 11 deletions genotype_api/api/endpoints/samples.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
from typing import List, Optional, Literal
from fastapi import APIRouter, Depends, Query
from fastapi.responses import JSONResponse
from datetime import datetime, timedelta, date
from datetime import timedelta, date
from starlette import status

import genotype_api.database.crud.create
from genotype_api.constants import SEXES
from genotype_api.database import get_session
from genotype_api.match import check_sample
from genotype_api.models import (
Sample,
SampleReadWithAnalysis,
SampleRead,
User,
SampleDetail,
Analysis,
MatchResult,
MatchCounts,
)
from genotype_api.database.models.models import (
ChrOertlin marked this conversation as resolved.
Show resolved Hide resolved
Analysis,
Sample,
SampleRead,
User,
SampleReadWithAnalysisDeep,
compare_genotypes,
)
from collections import Counter
from genotype_api import crud
from genotype_api.crud.samples import (
from genotype_api.database.crud.update import refresh_sample_status
from genotype_api.database.crud.read import (
get_incomplete_samples,
get_plate_samples,
get_commented_samples,
get_sample,
get_status_missing_samples,
refresh_sample_status,
get_sample,
get_samples,
)
from sqlmodel import Session, select
Expand Down Expand Up @@ -118,7 +119,7 @@ def create_sample(
session: Session = Depends(get_session),
current_user: User = Depends(get_active_user),
):
return crud.samples.create_sample(session=session, sample=sample)
return genotype_api.database.database.crud.create.create_sample(session=session, sample=sample)


@router.put("/{sample_id}/sex", response_model=SampleRead)
Expand Down
2 changes: 1 addition & 1 deletion genotype_api/api/endpoints/snps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Routes for the snps"""

from genotype_api.models import SNP, User
from genotype_api.database.models.models import SNP, User
from typing import List

from fastapi import APIRouter, Depends, HTTPException, Query, File, UploadFile
Expand Down
6 changes: 3 additions & 3 deletions genotype_api/api/endpoints/users.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""Routes for users"""

from typing import List, Optional
from typing import List

from fastapi import APIRouter, Depends, HTTPException, Query
from pydantic import EmailStr
from starlette import status
from starlette.responses import JSONResponse

from genotype_api.crud.users import get_user
from genotype_api.database.crud.read import get_user
from genotype_api.database import get_session
from genotype_api.models import User, UserRead, UserCreate, UserReadWithPlates
from genotype_api.database.models.models import User, UserRead, UserCreate, UserReadWithPlates
from sqlmodel import Session, select

from genotype_api.security import get_active_user
Expand Down
60 changes: 0 additions & 60 deletions genotype_api/crud/analyses.py

This file was deleted.

38 changes: 0 additions & 38 deletions genotype_api/crud/plates.py

This file was deleted.

83 changes: 0 additions & 83 deletions genotype_api/crud/samples.py

This file was deleted.

32 changes: 0 additions & 32 deletions genotype_api/crud/users.py

This file was deleted.

File renamed without changes.
Empty file.
Loading
Loading