utils/file-tester/lms_file_tester/validators/file_validation.py
def validate_grades_file(input_directory: str, sections: pd.DataFrame) -> List[str]:
    """
    Validates that the latest grades 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.
    sections: pd.DataFrame
        DataFrame containing section information read from a Sections file.

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

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

    expected = set(
        [
            "SourceSystemIdentifier",
            "SourceSystem",
            "Grade",
            "GradeType",
            "LMSUserLMSSectionAssociationSourceSystemIdentifier",
            "CreateDate",
            "LastModifiedDate",
            "SourceCreateDate",
            "SourceLastModifiedDate",
        ]
    )

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

    Validates that the latest grades 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.
    sections: pd.DataFrame
        DataFrame containing section information read from a Sections file.

    Returns
    -------
    List[str]
        List containing detailed error messages, if any.
    
Validates that the latest grades 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.
sections: pd.DataFrame
DataFrame containing section information read from a Sections file.

Returns

List[str]
List containing detailed error messages, if any.
Validates that the latest grades 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 . sections : pd . DataFrame DataFrame containing section information read from a Sections file . Returns List [ str ] List containing detailed error messages if any .
def validate_grades_file(input_directory: str, sections: pd.DataFrame) -> List[str]:
    df = fread.get_all_grades(input_directory, sections, nrows=2)
    if df.empty:
        return _file_is_empty("Grades")
    expected = set(
        [
            "SourceSystemIdentifier",
            "SourceSystem",
            "Grade",
            "GradeType",
            "LMSUserLMSSectionAssociationSourceSystemIdentifier",
            "CreateDate",
            "LastModifiedDate",
            "SourceCreateDate",
            "SourceLastModifiedDate",
        ]
    )
    return _validate_columns(
        expected, df, "Grades"
    ) + _validate_date_formats(df, "Grades")
def validate_grades_file ( input_directory : str , sections : pd . DataFrame ) -> List [ str ] : df = fread . get_all_grades ( input_directory , sections , nrows = 2 ) if df . empty : return _file_is_empty ( "Grades" ) expected = set ( [ "SourceSystemIdentifier" , "SourceSystem" , "Grade" , "GradeType" , "LMSUserLMSSectionAssociationSourceSystemIdentifier" , "CreateDate" , "LastModifiedDate" , "SourceCreateDate" , "SourceLastModifiedDate" , ] ) return _validate_columns ( expected , df , "Grades" ) + _validate_date_formats ( df , "Grades" )
Validates that the latest grades file has the expected
columns and all columns whose names end with `Date` or `DateTime` have the
proper format.
Validates that the latest grades file has the expected columns and all columns whose names end with ` Date ` or ` DateTime ` have the proper format .
"""
    Validates that the latest grades 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.
    sections: pd.DataFrame
        DataFrame containing section information read from a Sections file.

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