utils/file-tester/lms_file_tester/validators/file_validation.py
def validate_submissions_file(
    input_directory: str, assignments: pd.DataFrame
) -> List[str]:
    """
    Validates that the latest submissions file has the expected
    columns and all columns whose names end with `Date` or `DateTime` have the
    proper format.

    Parameters
    ----------
    input_directory: str
        Base / parent directory containing files created by an LMS extractor.
    assignments: pd.DataFrame
        DataFrame containing assignments information read from a Assignments file.

    Returns
    -------
    List[str]
        List containing detailed error messages, if any.
    """
    df = fread.get_all_submissions(input_directory, assignments, nrows=2)

    if df.empty:
        return _file_is_empty("Submissions")

    expected = set(
        [
            "SourceSystemIdentifier",
            "SourceSystem",
            "SubmissionStatus",
            "SubmissionDateTime",
            "EarnedPoints",
            "Grade",
            "AssignmentSourceSystemIdentifier",
            "LMSUserSourceSystemIdentifier",
            "CreateDate",
            "LastModifiedDate",
            "SourceCreateDate",
            "SourceLastModifiedDate",
        ]
    )

    return _validate_columns(
        expected, df, "Submissions"
    ) + _validate_date_formats(df, "Submissions")

    Validates that the latest submissions file has the expected
    columns and all columns whose names end with `Date` or `DateTime` have the
    proper format.

    Parameters
    ----------
    input_directory: str
        Base / parent directory containing files created by an LMS extractor.
    assignments: pd.DataFrame
        DataFrame containing assignments information read from a Assignments file.

    Returns
    -------
    List[str]
        List containing detailed error messages, if any.
    
Validates that the latest submissions file has the expected
columns and all columns whose names end with `Date` or `DateTime` have the
proper format.

Parameters

str
Base / parent directory containing files created by an LMS extractor.
assignments: pd.DataFrame
DataFrame containing assignments information read from a Assignments file.

Returns

List[str]
List containing detailed error messages, if any.
Validates that the latest submissions file has the expected columns and all columns whose names end with ` Date ` or ` DateTime ` have the proper format . Parameters str Base / parent directory containing files created by an LMS extractor . assignments : pd . DataFrame DataFrame containing assignments information read from a Assignments file . Returns List [ str ] List containing detailed error messages if any .
def validate_submissions_file(
    input_directory: str, assignments: pd.DataFrame
) -> List[str]:
    df = fread.get_all_submissions(input_directory, assignments, nrows=2)
    if df.empty:
        return _file_is_empty("Submissions")
    expected = set(
        [
            "SourceSystemIdentifier",
            "SourceSystem",
            "SubmissionStatus",
            "SubmissionDateTime",
            "EarnedPoints",
            "Grade",
            "AssignmentSourceSystemIdentifier",
            "LMSUserSourceSystemIdentifier",
            "CreateDate",
            "LastModifiedDate",
            "SourceCreateDate",
            "SourceLastModifiedDate",
        ]
    )
    return _validate_columns(
        expected, df, "Submissions"
    ) + _validate_date_formats(df, "Submissions")
def validate_submissions_file ( input_directory : str , assignments : pd . DataFrame ) -> List [ str ] : df = fread . get_all_submissions ( input_directory , assignments , nrows = 2 ) if df . empty : return _file_is_empty ( "Submissions" ) expected = set ( [ "SourceSystemIdentifier" , "SourceSystem" , "SubmissionStatus" , "SubmissionDateTime" , "EarnedPoints" , "Grade" , "AssignmentSourceSystemIdentifier" , "LMSUserSourceSystemIdentifier" , "CreateDate" , "LastModifiedDate" , "SourceCreateDate" , "SourceLastModifiedDate" , ] ) return _validate_columns ( expected , df , "Submissions" ) + _validate_date_formats ( df , "Submissions" )
Validates that the latest submissions file has the expected
columns and all columns whose names end with `Date` or `DateTime` have the
proper format.
Validates that the latest submissions file has the expected columns and all columns whose names end with ` Date ` or ` DateTime ` have the proper format .
"""
    Validates that the latest submissions file has the expected
    columns and all columns whose names end with `Date` or `DateTime` have the
    proper format.

    Parameters
    ----------
    input_directory: str
        Base / parent directory containing files created by an LMS extractor.
    assignments: pd.DataFrame
        DataFrame containing assignments information read from a Assignments file.

    Returns
    -------
    List[str]
        List containing detailed error messages, if any.
    """
input_directory
str
assignments
pd.DataFrame