def remote_write(xml_data): ''' save data in given path :returns: True when file is written ''' written = False try: meta_names = extract_meta_names(xml_data) root_dir_csv = conf.get("smarter_score_batcher.base_dir.csv") if root_dir_csv is not None: root_dir_csv = os.path.abspath(root_dir_csv) root_dir_xml = conf.get("smarter_score_batcher.base_dir.xml") if root_dir_xml is not None: root_dir_xml = os.path.abspath(root_dir_xml) timestamp = time.strftime('%Y%m%d%H%M%S', time.gmtime()) xml_file_path = create_path(root_dir_xml, meta_names, generate_file_path, **{'extension': timestamp + '.xml'}) if os.path.commonprefix([root_dir_xml, xml_file_path]) != root_dir_xml: raise TSBSecurityException(msg='Fail to create filepath name requested dir[' + xml_file_path + ']', err_code=ErrorCode.PATH_TRAVERSAL_DETECTED, err_source=ErrorSource.REMOTE_WRITE) written = file_writer(xml_file_path, xml_data) if written: work_dir = conf.get("smarter_score_batcher.base_dir.working") if work_dir is not None: work_dir = os.path.abspath(work_dir) queue_name = conf.get('smarter_score_batcher.async_queue') csv_file_path = create_path(root_dir_csv, meta_names, generate_path_to_item_csv) if os.path.commonprefix([root_dir_csv, csv_file_path]) != root_dir_csv: raise TSBSecurityException(msg='Fail to create filepath name requested dir[' + csv_file_path + ']', err_code=ErrorCode.PATH_TRAVERSAL_DETECTED, err_source=ErrorSource.REMOTE_WRITE) metadata_queue = conf.get('smarter_score_batcher.metadata_queue') # Fire two celery tasks - one to generate metadata for xml, and one to generate item level/assessment csv metadata_generator_task.apply_async(args=(xml_file_path,), queue=metadata_queue) # @UndefinedVariable remote_csv_generator.apply_async(args=(meta_names, csv_file_path, xml_file_path, work_dir, metadata_queue), queue=queue_name) # @UndefinedVariable except TSBException as e: # ignore exception for error handling because this function is synchonous call logging.error(str(e)) return written
def remote_write(xml_data): ''' save data in given path :returns: True when file is written ''' written = False try: meta_names = extract_meta_names(xml_data) root_dir_csv = conf.get("smarter_score_batcher.base_dir.csv") if root_dir_csv is not None: root_dir_csv = os.path.abspath(root_dir_csv) root_dir_xml = conf.get("smarter_score_batcher.base_dir.xml") if root_dir_xml is not None: root_dir_xml = os.path.abspath(root_dir_xml) timestamp = time.strftime('%Y%m%d%H%M%S', time.gmtime()) xml_file_path = create_path(root_dir_xml, meta_names, generate_file_path, **{'extension': timestamp + '.xml'}) if os.path.commonprefix([root_dir_xml, xml_file_path]) != root_dir_xml: raise TSBSecurityException( msg='Fail to create filepath name requested dir[' + xml_file_path + ']', err_code=ErrorCode.PATH_TRAVERSAL_DETECTED, err_source=ErrorSource.REMOTE_WRITE) written = file_writer(xml_file_path, xml_data) if written: work_dir = conf.get("smarter_score_batcher.base_dir.working") if work_dir is not None: work_dir = os.path.abspath(work_dir) queue_name = conf.get('smarter_score_batcher.async_queue') csv_file_path = create_path(root_dir_csv, meta_names, generate_path_to_item_csv) if os.path.commonprefix([root_dir_csv, csv_file_path ]) != root_dir_csv: raise TSBSecurityException( msg='Fail to create filepath name requested dir[' + csv_file_path + ']', err_code=ErrorCode.PATH_TRAVERSAL_DETECTED, err_source=ErrorSource.REMOTE_WRITE) metadata_queue = conf.get('smarter_score_batcher.metadata_queue') # Fire two celery tasks - one to generate metadata for xml, and one to generate item level/assessment csv metadata_generator_task.apply_async( args=(xml_file_path, ), queue=metadata_queue) # @UndefinedVariable remote_csv_generator.apply_async( args=(meta_names, csv_file_path, xml_file_path, work_dir, metadata_queue), queue=queue_name) # @UndefinedVariable except TSBException as e: # ignore exception for error handling because this function is synchonous call logging.error(str(e)) return written
def get_assessment_metadata_mapping(root): ''' Returns assessment guid and the json format needed for landing zone assessment file ''' opportunity = root.find("./Opportunity") test_node = root.find("./Test") asmt_type = extract_meta_without_fallback_helper(root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") academic_year = extract_meta_without_fallback_helper( root, "./Test", "academicYear") effective_date = extract_meta_without_fallback_helper( root, "./Opportunity", "dateCompleted") meta_class = load_class( conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) meta = meta_class(True, '', '', '', academic_year, asmt_type, subject, grade, effective_date, asmt_id) meta_template_manager = component.queryUtility(IMetadataTemplateManager) meta_template = meta_template_manager.get_template( get_template_key(meta.academic_year, meta.asmt_type, meta.grade, meta.subject)) json_output = JSONHeaders(meta_template) # attach claim1 information if it doesn't exist if not json_output.claim1_name: claim1_mapping = get_claim1_mapping(opportunity) if not claim1_mapping or claim1_mapping is not None: claim1_mapping = meta.test_label json_output.claim1_name = claim1_mapping mappings = [ JSONMapping(ValueMeta(meta.asmt_id), json_output, 'asmt_guid'), JSONMapping(ValueMeta(meta.effective_date), json_output, 'effective_date'), JSONMapping(ValueMeta(meta.subject), json_output, 'subject'), JSONMapping(ValueMeta(meta.asmt_type), json_output, 'asmt_type', upper_case=True), JSONMapping(XMLMeta(test_node, ".", "assessmentVersion"), json_output, 'asmt_version'), JSONMapping(ValueMeta(meta.academic_year), json_output, 'asmt_year') ] for m in mappings: m.evaluate() return meta.asmt_id, json_output.get_values()
def _init_asmt_id_asmt_type(): ''' to be efficient use hashmap to lookup asmt_type by subject ''' here = os.path.abspath(os.path.dirname(__file__)) subject_asmt_type_file = conf.get('smarter_score_batcher.mapping.subject_asmt_type.file', os.path.join(here, '../../../../resources/mapping/testId_asmt_type.json')) subject_asmt_type = {} path = os.path.abspath(subject_asmt_type_file) with open(path) as f: json_subject_asmt_type = json.load(f) for asmt_type in json_subject_asmt_type.keys(): testIds = json_subject_asmt_type[asmt_type] for testId, testLabel in testIds.items(): subject_asmt_type[testId.upper()] = {ASMT_TYPE: asmt_type, TEST_LABEL: testLabel} return subject_asmt_type
def extract_meta_names(raw_xml_string): ''' Validates and extracts meta from the XML. Returns: True if meta for file path is valid. And the parts for folder creation. :param raw_xml_string: xml data ''' try: root = ET.fromstring(raw_xml_string) state_code = extract_meta_with_fallback_helper(root, "./Examinee/ExamineeRelationship/[@name='StateAbbreviation']", "value", "context") student_id = extract_meta_with_fallback_helper(root, "./Examinee/ExamineeAttribute/[@name='StudentIdentifier']", "value", "context") district_id = extract_meta_with_fallback_helper(root, "./Examinee/ExamineeRelationship/[@name='ResponsibleDistrictIdentifier']", "value", "context") academic_year = extract_meta_without_fallback_helper(root, "./Test", "academicYear") asmt_type = extract_meta_without_fallback_helper(root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") effective_date = extract_meta_without_fallback_helper(root, "./Opportunity", "dateCompleted") # Get asmt id, not required for validation asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") validMeta = (state_code and student_id and district_id and academic_year and asmt_type and subject and grade and effective_date) if not validMeta: error_msg = '' if not state_code: error_msg += os.linesep + 'extract_meta_names: state_code is missing' if not student_id: error_msg += os.linesep + 'extract_meta_names: student_id is missing' if not district_id: error_msg += os.linesep + 'extract_meta_names: district_id is missing' if not academic_year: error_msg += os.linesep + 'extract_meta_names: academic_year is missing' if not asmt_type: error_msg += os.linesep + 'extract_meta_names: asmt_type is missing' if not subject: error_msg += os.linesep + 'extract_meta_names: subject is missing' if not grade: error_msg += os.linesep + 'extract_meta_names: grade is missing' if not effective_date: error_msg += os.linesep + 'extract_meta_names: effective_date is missing' logger.error(error_msg) raise MetaNamesException(error_msg) meta_class = load_class(conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) return meta_class(validMeta, student_id, state_code, district_id, academic_year, asmt_type, subject, grade, effective_date, asmt_id) except ET.ParseError: raise EdApiHTTPPreconditionFailed("Invalid XML")
def get_assessment_metadata_mapping(root): ''' Returns assessment guid and the json format needed for landing zone assessment file ''' opportunity = root.find("./Opportunity") test_node = root.find("./Test") asmt_type = extract_meta_without_fallback_helper(root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") academic_year = extract_meta_without_fallback_helper(root, "./Test", "academicYear") effective_date = extract_meta_without_fallback_helper(root, "./Opportunity", "dateCompleted") meta_class = load_class(conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) meta = meta_class(True, '', '', '', academic_year, asmt_type, subject, grade, effective_date, asmt_id) meta_template_manager = component.queryUtility(IMetadataTemplateManager) meta_template = meta_template_manager.get_template(get_template_key(meta.academic_year, meta.asmt_type, meta.grade, meta.subject)) json_output = JSONHeaders(meta_template) # attach claim1 information if it doesn't exist if not json_output.claim1_name: claim1_mapping = get_claim1_mapping(opportunity) if not claim1_mapping or claim1_mapping is not None: claim1_mapping = meta.test_label json_output.claim1_name = claim1_mapping mappings = [JSONMapping(ValueMeta(meta.asmt_id), json_output, 'asmt_guid'), JSONMapping(ValueMeta(meta.effective_date), json_output, 'effective_date'), JSONMapping(ValueMeta(meta.subject), json_output, 'subject'), JSONMapping(ValueMeta(meta.asmt_type), json_output, 'asmt_type', upper_case=True), JSONMapping(XMLMeta(test_node, ".", "assessmentVersion"), json_output, 'asmt_version'), JSONMapping(ValueMeta(meta.academic_year), json_output, 'asmt_year')] for m in mappings: m.evaluate() return meta.asmt_id, json_output.get_values()
def get_assessment_mapping(root, metadata): ''' Returns state code and the landing zone format of assessment csv file ''' examinee = root.find("./Examinee") opportunity = root.find("./Opportunity") test_node = root.find("./Test") groups = get_groups(examinee) accommodations = get_accommodations(opportunity) claims = get_claims(metadata, opportunity) asmt_type = extract_meta_without_fallback_helper(root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") academic_year = extract_meta_without_fallback_helper(root, "./Test", "academicYear") effective_date = extract_meta_without_fallback_helper(root, "./Opportunity", "dateCompleted") completeStatus = extract_meta_without_fallback_helper(root, "./Opportunity", "completeStatus") administrationCondition = extract_meta_without_fallback_helper(root, "./Opportunity", "administrationCondition") meta_class = load_class(conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) meta = meta_class(True, '', '', '', academic_year, asmt_type, subject, grade, effective_date, asmt_id) stateCode = XMLMeta(examinee, "./ExamineeRelationship/[@name='StateAbbreviation']", "value", "context") # In the order of the LZ mapping for easier maintenance mappings = AssessmentData([Mapping(stateCode, AssessmentHeaders.StateAbbreviation), Mapping(XMLMeta(examinee, "./ExamineeRelationship/[@name='ResponsibleDistrictIdentifier']", "value", "context"), AssessmentHeaders.ResponsibleDistrictIdentifier), Mapping(XMLMeta(examinee, "./ExamineeRelationship/[@name='OrganizationName']", "value", "context"), AssessmentHeaders.OrganizationName), Mapping(XMLMeta(examinee, "./ExamineeRelationship/[@name='ResponsibleInstitutionIdentifier']", "value", "context"), AssessmentHeaders.ResponsibleSchoolIdentifier), Mapping(XMLMeta(examinee, "./ExamineeRelationship/[@name='NameOfInstitution']", "value", "context"), AssessmentHeaders.NameOfInstitution), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='StudentIdentifier']", "value", "context"), AssessmentHeaders.StudentIdentifier), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='AlternateSSID']", "value", "context"), AssessmentHeaders.ExternalSSID), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='FirstName']", "value", "context"), AssessmentHeaders.FirstName), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='MiddleName']", "value", "context"), AssessmentHeaders.MiddleName), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='LastOrSurname']", "value", "context"), AssessmentHeaders.LastOrSurname), Mapping(XMLMeta(examinee, "./ExamineeAttribute/[@name='Sex']", "value", "context"), AssessmentHeaders.Sex), Mapping(DateMeta(examinee, "./ExamineeAttribute/[@name='Birthdate']", "value", "context"), AssessmentHeaders.Birthdate), Mapping(IntegerMeta(examinee, "./ExamineeAttribute/[@name='GradeLevelWhenAssessed']", "value", "context"), AssessmentHeaders.GradeLevelWhenAssessed), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='HispanicOrLatinoEthnicity']", "value", "context"), AssessmentHeaders.HispanicOrLatinoEthnicity), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='AmericanIndianOrAlaskaNative']", "value", "context"), AssessmentHeaders.AmericanIndianOrAlaskaNative), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='Asian']", "value", "context"), AssessmentHeaders.Asian), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='BlackOrAfricanAmerican']", "value", "context"), AssessmentHeaders.BlackOrAfricanAmerican), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='NativeHawaiianOrOtherPacificIslander']", "value", "context"), AssessmentHeaders.NativeHawaiianOrOtherPacificIslander), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='White']", "value", "context"), AssessmentHeaders.White), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='DemographicRaceTwoOrMoreRaces']", "value", "context"), AssessmentHeaders.DemographicRaceTwoOrMoreRaces), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='IDEAIndicator']", "value", "context"), AssessmentHeaders.IDEAIndicator), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='LEPStatus']", "value", "context"), AssessmentHeaders.LEPStatus), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='Section504Status']", "value", "context"), AssessmentHeaders.Section504Status), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='EconomicDisadvantageStatus']", "value", "context"), AssessmentHeaders.EconomicDisadvantageStatus), Mapping(YesNoMeta(examinee, "./ExamineeAttribute/[@name='MigrantStatus']", "value", "context"), AssessmentHeaders.MigrantStatus), Mapping(ValueMeta(meta.asmt_id), AssessmentHeaders.AssessmentGuid), Mapping(XMLMeta(opportunity, ".", "oppId"), AssessmentHeaders.AssessmentSessionLocationId), Mapping(XMLMeta(opportunity, ".", "server"), AssessmentHeaders.AssessmentSessionLocation), Mapping(ValueMeta(meta.effective_date), AssessmentHeaders.AssessmentAdministrationFinishDate), Mapping(ValueMeta(meta.academic_year), AssessmentHeaders.AssessmentYear), Mapping(ValueMeta(meta.asmt_type), AssessmentHeaders.AssessmentType), Mapping(ValueMeta(meta.subject), AssessmentHeaders.AssessmentAcademicSubject), Mapping(ValueMeta(administrationCondition), AssessmentHeaders.AdministrationCondition), Mapping(ValueMeta(completeStatus), AssessmentHeaders.CompleteStatus), Mapping(ValueMeta(meta.grade), AssessmentHeaders.AssessmentLevelForWhichDesigned)], claims, groups, accommodations) mappings.evaluate() return stateCode.get_value(), mappings
def extract_meta_names(raw_xml_string): ''' Validates and extracts meta from the XML. Returns: True if meta for file path is valid. And the parts for folder creation. :param raw_xml_string: xml data ''' try: root = ET.fromstring(raw_xml_string) state_code = extract_meta_with_fallback_helper( root, "./Examinee/ExamineeRelationship/[@name='StateAbbreviation']", "value", "context") student_id = extract_meta_with_fallback_helper( root, "./Examinee/ExamineeAttribute/[@name='StudentIdentifier']", "value", "context") district_id = extract_meta_with_fallback_helper( root, "./Examinee/ExamineeRelationship/[@name='ResponsibleDistrictIdentifier']", "value", "context") academic_year = extract_meta_without_fallback_helper( root, "./Test", "academicYear") asmt_type = extract_meta_without_fallback_helper( root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") effective_date = extract_meta_without_fallback_helper( root, "./Opportunity", "dateCompleted") # Get asmt id, not required for validation asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") validMeta = (state_code and student_id and district_id and academic_year and asmt_type and subject and grade and effective_date) if not validMeta: error_msg = '' if not state_code: error_msg += os.linesep + 'extract_meta_names: state_code is missing' if not student_id: error_msg += os.linesep + 'extract_meta_names: student_id is missing' if not district_id: error_msg += os.linesep + 'extract_meta_names: district_id is missing' if not academic_year: error_msg += os.linesep + 'extract_meta_names: academic_year is missing' if not asmt_type: error_msg += os.linesep + 'extract_meta_names: asmt_type is missing' if not subject: error_msg += os.linesep + 'extract_meta_names: subject is missing' if not grade: error_msg += os.linesep + 'extract_meta_names: grade is missing' if not effective_date: error_msg += os.linesep + 'extract_meta_names: effective_date is missing' logger.error(error_msg) raise MetaNamesException(error_msg) meta_class = load_class( conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) return meta_class(validMeta, student_id, state_code, district_id, academic_year, asmt_type, subject, grade, effective_date, asmt_id) except ET.ParseError: raise EdApiHTTPPreconditionFailed("Invalid XML")
def get_assessment_mapping(root, metadata): ''' Returns state code and the landing zone format of assessment csv file ''' examinee = root.find("./Examinee") opportunity = root.find("./Opportunity") test_node = root.find("./Test") groups = get_groups(examinee) accommodations = get_accommodations(opportunity) claims = get_claims(metadata, opportunity) asmt_type = extract_meta_without_fallback_helper(root, "./Test", "assessmentType") subject = extract_meta_without_fallback_helper(root, "./Test", "subject") grade = extract_meta_without_fallback_helper(root, "./Test", "grade") asmt_id = extract_meta_without_fallback_helper(root, "./Test", "testId") academic_year = extract_meta_without_fallback_helper( root, "./Test", "academicYear") effective_date = extract_meta_without_fallback_helper( root, "./Opportunity", "dateCompleted") completeStatus = extract_meta_without_fallback_helper( root, "./Opportunity", "completeStatus") administrationCondition = extract_meta_without_fallback_helper( root, "./Opportunity", "administrationCondition") meta_class = load_class( conf.get('smarter_score_batcher.class.meta', 'smarter_score_batcher.utils.meta.Meta')) meta = meta_class(True, '', '', '', academic_year, asmt_type, subject, grade, effective_date, asmt_id) stateCode = XMLMeta(examinee, "./ExamineeRelationship/[@name='StateAbbreviation']", "value", "context") # In the order of the LZ mapping for easier maintenance mappings = AssessmentData([ Mapping(stateCode, AssessmentHeaders.StateAbbreviation), Mapping( XMLMeta( examinee, "./ExamineeRelationship/[@name='ResponsibleDistrictIdentifier']", "value", "context"), AssessmentHeaders.ResponsibleDistrictIdentifier), Mapping( XMLMeta(examinee, "./ExamineeRelationship/[@name='OrganizationName']", "value", "context"), AssessmentHeaders.OrganizationName), Mapping( XMLMeta( examinee, "./ExamineeRelationship/[@name='ResponsibleInstitutionIdentifier']", "value", "context"), AssessmentHeaders.ResponsibleSchoolIdentifier), Mapping( XMLMeta(examinee, "./ExamineeRelationship/[@name='NameOfInstitution']", "value", "context"), AssessmentHeaders.NameOfInstitution), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='StudentIdentifier']", "value", "context"), AssessmentHeaders.StudentIdentifier), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='AlternateSSID']", "value", "context"), AssessmentHeaders.ExternalSSID), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='FirstName']", "value", "context"), AssessmentHeaders.FirstName), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='MiddleName']", "value", "context"), AssessmentHeaders.MiddleName), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='LastOrSurname']", "value", "context"), AssessmentHeaders.LastOrSurname), Mapping( XMLMeta(examinee, "./ExamineeAttribute/[@name='Sex']", "value", "context"), AssessmentHeaders.Sex), Mapping( DateMeta(examinee, "./ExamineeAttribute/[@name='Birthdate']", "value", "context"), AssessmentHeaders.Birthdate), Mapping( IntegerMeta( examinee, "./ExamineeAttribute/[@name='GradeLevelWhenAssessed']", "value", "context"), AssessmentHeaders.GradeLevelWhenAssessed), Mapping( YesNoMeta( examinee, "./ExamineeAttribute/[@name='HispanicOrLatinoEthnicity']", "value", "context"), AssessmentHeaders.HispanicOrLatinoEthnicity), Mapping( YesNoMeta( examinee, "./ExamineeAttribute/[@name='AmericanIndianOrAlaskaNative']", "value", "context"), AssessmentHeaders.AmericanIndianOrAlaskaNative), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='Asian']", "value", "context"), AssessmentHeaders.Asian), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='BlackOrAfricanAmerican']", "value", "context"), AssessmentHeaders.BlackOrAfricanAmerican), Mapping( YesNoMeta( examinee, "./ExamineeAttribute/[@name='NativeHawaiianOrOtherPacificIslander']", "value", "context"), AssessmentHeaders.NativeHawaiianOrOtherPacificIslander), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='White']", "value", "context"), AssessmentHeaders.White), Mapping( YesNoMeta( examinee, "./ExamineeAttribute/[@name='DemographicRaceTwoOrMoreRaces']", "value", "context"), AssessmentHeaders.DemographicRaceTwoOrMoreRaces), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='IDEAIndicator']", "value", "context"), AssessmentHeaders.IDEAIndicator), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='LEPStatus']", "value", "context"), AssessmentHeaders.LEPStatus), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='Section504Status']", "value", "context"), AssessmentHeaders.Section504Status), Mapping( YesNoMeta( examinee, "./ExamineeAttribute/[@name='EconomicDisadvantageStatus']", "value", "context"), AssessmentHeaders.EconomicDisadvantageStatus), Mapping( YesNoMeta(examinee, "./ExamineeAttribute/[@name='MigrantStatus']", "value", "context"), AssessmentHeaders.MigrantStatus), Mapping(ValueMeta(meta.asmt_id), AssessmentHeaders.AssessmentGuid), Mapping(XMLMeta(opportunity, ".", "oppId"), AssessmentHeaders.AssessmentSessionLocationId), Mapping(XMLMeta(opportunity, ".", "server"), AssessmentHeaders.AssessmentSessionLocation), Mapping(ValueMeta(meta.effective_date), AssessmentHeaders.AssessmentAdministrationFinishDate), Mapping(ValueMeta(meta.academic_year), AssessmentHeaders.AssessmentYear), Mapping(ValueMeta(meta.asmt_type), AssessmentHeaders.AssessmentType), Mapping(ValueMeta(meta.subject), AssessmentHeaders.AssessmentAcademicSubject), Mapping(ValueMeta(administrationCondition), AssessmentHeaders.AdministrationCondition), Mapping(ValueMeta(completeStatus), AssessmentHeaders.CompleteStatus), Mapping(ValueMeta(meta.grade), AssessmentHeaders.AssessmentLevelForWhichDesigned) ], claims, groups, accommodations) mappings.evaluate() return stateCode.get_value(), mappings
def _get_default_configured_path(self): return conf.get('smarter_score_batcher.metadata.default', '../../resources/meta/default')
def _get_static_configured_path(self): return conf.get('smarter_score_batcher.metadata.static', '../../resources/meta/static')
def _get_performance_configured_path(self): return conf.get('smarter_score_batcher.metadata.performance', '../../resources/meta/performance')