# Path: virtool/analyses/models.py
# class AnalysisFile(Base):
#     """
#     SQL model to store new analysis files
# 
#     """
# 
#     __tablename__ = "analysis_files"
# 
#     id = Column(Integer, primary_key=True)
#     analysis = Column(String)
#     description = Column(String)
#     format = Column(Enum(AnalysisFormat))
#     name = Column(String)
#     name_on_disk = Column(String, unique=True)
#     size = Column(BigInteger)
#     uploaded_at = Column(DateTime)


from pathlib import Path
from typing import Dict
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession
from virtool.analyses.models import AnalysisFile
import virtool.analyses.utils
import virtool.utils

        analysis_file = analysis_file.to_dict()

        await session.commit()

        return analysis_file


async def create_nuvs_analysis_files(
    pg: AsyncEngine, analysis_id: str, files: list, file_path: Path
):
    """
    Create a row in the `analysis_files` SQL table that represents an NuVs analysis result file.

    :param pg: PostgreSQL AsyncEngine object
    :param analysis_id: ID that corresponds to a parent analysis
    :param files: a list of analysis files
    :param file_path: the path to the analysis files directory
    """
    analysis_files = list()

    for filename in files:
        file_type = virtool.analyses.utils.check_nuvs_file_type(filename)

        if not filename.endswith(".tsv"):
            filename += ".gz"

        size = virtool.utils.file_stats(file_path / filename)["size"]

        analysis_files.append(

# Path: virtool/analyses/models.py
# class AnalysisFile(Base):
#     """
#     SQL model to store new analysis files
# 
#     """
# 
#     __tablename__ = "analysis_files"
# 
#     id = Column(Integer, primary_key=True)
#     analysis = Column(String)
#     description = Column(String)
#     format = Column(Enum(AnalysisFormat))
#     name = Column(String)
#     name_on_disk = Column(String, unique=True)
#     size = Column(BigInteger)
#     uploaded_at = Column(DateTime)


# Path: virtool/analyses/files.py
from pathlib import Path
from typing import Dict
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession
from virtool.analyses.models import AnalysisFile
import virtool.analyses.utils
import virtool.utils


        analysis_file = analysis_file.to_dict()

        await session.commit()

        return analysis_file


async def create_nuvs_analysis_files(
    pg: AsyncEngine, analysis_id: str, files: list, file_path: Path
):
    """
    Create a row in the `analysis_files` SQL table that represents an NuVs analysis result file.

    :param pg: PostgreSQL AsyncEngine object
    :param analysis_id: ID that corresponds to a parent analysis
    :param files: a list of analysis files
    :param file_path: the path to the analysis files directory
    """
    analysis_files = list()

    for filename in files:
        file_type = virtool.analyses.utils.check_nuvs_file_type(filename)

        if not filename.endswith(".tsv"):
            filename += ".gz"

        size = virtool.utils.file_stats(file_path / filename)["size"]

        analysis_files.append(

            AnalysisFile(