diff --git a/lib/importer/csv_importer.rb b/lib/importer/csv_importer.rb index 26c34b3f1..04d7d09fb 100644 --- a/lib/importer/csv_importer.rb +++ b/lib/importer/csv_importer.rb @@ -3,12 +3,17 @@ module Importer # header row. The model for each row can either be specified in a column called # 'type' or globally by passing the model attribute class CSVImporter + # @param [String] metadata_file path to CSV file + # @param [String] files_directory path, passed to factory constructor + # @param [#to_s, Class] model if Class, the factory class to be invoked per row. + # Otherwise, the stringable first (Xxx) portion of an "XxxFactory" constant. def initialize(metadata_file, files_directory, model = nil) - @model = model - @files_directory = files_directory @metadata_file = metadata_file + @files_directory = files_directory + @model = model end + # @return [Integer] count of objects created def import_all count = 0 parser.each do |attributes| @@ -24,16 +29,23 @@ def parser CSVParser.new(@metadata_file) end - # Build a factory to create the objects in fedora. - def create_fedora_objects(attributes) - model = attributes.delete(:type) || @model.to_s + # @return [Class] the model class to be used + def factory_class(model) + return model if model.is_a?(Class) if model.empty? $stderr.puts 'ERROR: No model was specified' - # rubocop:disable Rails/Exit - exit(1) - # rubocop:enable Rails/Exit + exit(1) # rubocop:disable Rails/Exit end - Factory.for(model).new(attributes, @files_directory).run + return Factory.for(model.to_s) if model.respond_to?(:to_s) + raise "Unrecognized model type: #{model.class}" + end + + # Build a factory to create the objects in fedora. + # @param [Hash<Symbol => String>] attributes + # @option attributes [String] :type overrides model for a single object + # @note remaining attributes are passed to factory constructor + def create_fedora_objects(attributes) + factory_class(attributes.delete(:type) || @model).new(attributes, @files_directory).run end end end diff --git a/lib/importer/factory.rb b/lib/importer/factory.rb index 87d30b663..bbb239a98 100644 --- a/lib/importer/factory.rb +++ b/lib/importer/factory.rb @@ -11,6 +11,7 @@ module Factory autoload :WithAssociatedCollection end + # @param [#to_s] First (Xxx) portion of an "XxxFactory" constant def self.for(model_name) const_get "#{model_name}Factory" end diff --git a/spec/fixtures/csv/gse_metadata.csv b/spec/fixtures/csv/gse_metadata.csv index 91475cb20..e09febd69 100644 --- a/spec/fixtures/csv/gse_metadata.csv +++ b/spec/fixtures/csv/gse_metadata.csv @@ -1,12 +1,12 @@ id,type,title,description,subject,subject,subject,subject,subject,subject,resource_type,contributor,contributor,contributor,contributor,contributor,contributor,contributor,contributor,contributor,contributor,contributor,date_created,file wg827ks1643,ETD,Work in Progress - A Framework for Building Interactive Learning Modules,"The development of good quality educational software is expensive, time-consuming and faces some underlying issues. In order to deal with such issues, many attempts were made, mainly on code reuse. Following a similar approach, the development of an application framework for implementing a family of interactivity-intense educational software called Interactive Learning Modules – iLM is presented. The framework main goal is to reduce development efforts while being part of a Software Product Line – SPL, an innovative technique regarding interactivity-intense educational software. The framework specification is presented by analyzing the common features of existing iLM. Therefore, the resulting component architecture is outlined. Currently, the design phase is finished and the implementation ongoing. Also, its instantiation is planned for an existing iLM, as a proof of concept.", -- educational software, -- software product line, -- application framework,,,,text,"Dalmon, Danilo","Brandao, Leonidas","Brandao, Anarosa","Isotani, Seiji",,,,,,,,2011,DalmonEtAl2011_Framework_Final.pdf wm346hj8366,ETD,Knowing their lines: how social boundaries undermine equity-based integration policies in United States and South African schools,"""In this paper we argue that although the United States and South Africa have produced qualitatively different national frames about the necessity for racial integration in education, certain practices converge in both nations at the school level that thwart integrationist goals. Drawing on sociologist Jeannie Oakes and colleagues' idea of schools as """"zones of mediation"""" of economic, racial, social, and cultural phenomena, we provide empirical evidence of how a complex set of social interactions, sustained by explicit organized school practices, limit educators' and students' abilities to accept and comply with integrationist aims of equity and the redress of cumulative disadvantages due to past racial discrimination. We discuss how social and symbolic boundaries reproduced by educational actors in everyday school practices illuminate the macromicro tension between the goals of racial integration policy and perceived group interests. Our arguments emerge from thorough analyses of ethnographic, interview, and survey data obtained over a four-year period from multiracial and desegregated schools located in four US and South African cities. """, -- desegregation, -- equity, -- high-school integration, -- race, -- zones of mediation,,text,"Carter, Prudence L.","Caruthers, Jakeya ",Perspectives in Education,,,,,,,,,2009-12, -ws021tj9578,ETD,The lure of statistics for educational researchers,"In this paper I explore the historical and sociological elements that have made educational researchers dependent on statistics – as a mechanism to shore up their credibility, enhance their scholarly standing, and increase their influence in the realm of educational policy. I begin by tracing the roots of the urge to quantify within the mentality of measurement that arose in medieval Europe, and then explore the factors that have pressured disciplines and professions over the years to incorporate the language of mathematics into their discourse. In particular, this pattern has been prominent for domains of knowledge and professional endeavor whose prestige is modest, whose credibility is questionable, whose professional boundaries are weak, and whose knowledge orientation is applied. I show that educational research as a domain – with its focus on a radically soft and thoroughly applied form of knowledge and with its low academic standing – fits these criteria to a tee. Then I examine two kinds of problems that derive from educational researchers’ seduction by the quantitative turn. One is that this approach to educational questions deflects attention away from many of the most important issues in the field, which are not easily reduced to standardized quanta. Another is that by adopting this rationalized, quantified, abstracted, statist, and reductionist vision of education, education policymakers risk imposing reforms that will destroy the local practical knowledge that makes the ecology of the individual classroom function effectively. Quantification, I suggest, may be useful for the professional interests of educational researchers but it can be devastating in its consequences for school and society.", -- Statistics, -- educational research, -- history of education,,,,text,"Labaree, David F.",,,,,,,,,,,2010, -wt654sd9926,ETD,Teaching Teachers to Build Equitable Classrooms,"Whether they are the outcome of global immigration trends, residential living patterns, or educational reform efforts such as detracking, heterogeneous classrooms pose considerable pedagogical challenges for educators. This article describes a systemic approach to restructuring the classroom with the goal of establishing and maintaining an equitable environment by creating curriculum, instruction, and assessments deliberately and purposefully to address the range of previous academic achievement and academic skills, the linguistic variability, and the intellectual diversity found in heterogeneous classrooms. A reconceptualization of intellectual competence, academic ability, or just plain being smart is at the core of teachers' efforts to build equitable classrooms. In practice, to narrow the achievement gap and to build equitable classrooms, teachers need to work toward equal-status, balanced interaction among students working together in small learning groups. The article also details the necessary conditions for teachers to learn and to practice equitable pedagogy.", -- detracking, -- educational change, -- emigration, -- immigration, -- mixed ability grouping, -- tracking,text,"Lotan, Rachel",Taylor & Francis Group,,,,,,,,,,2006, +ws021tj9578,,The lure of statistics for educational researchers,"In this paper I explore the historical and sociological elements that have made educational researchers dependent on statistics – as a mechanism to shore up their credibility, enhance their scholarly standing, and increase their influence in the realm of educational policy. I begin by tracing the roots of the urge to quantify within the mentality of measurement that arose in medieval Europe, and then explore the factors that have pressured disciplines and professions over the years to incorporate the language of mathematics into their discourse. In particular, this pattern has been prominent for domains of knowledge and professional endeavor whose prestige is modest, whose credibility is questionable, whose professional boundaries are weak, and whose knowledge orientation is applied. I show that educational research as a domain – with its focus on a radically soft and thoroughly applied form of knowledge and with its low academic standing – fits these criteria to a tee. Then I examine two kinds of problems that derive from educational researchers’ seduction by the quantitative turn. One is that this approach to educational questions deflects attention away from many of the most important issues in the field, which are not easily reduced to standardized quanta. Another is that by adopting this rationalized, quantified, abstracted, statist, and reductionist vision of education, education policymakers risk imposing reforms that will destroy the local practical knowledge that makes the ecology of the individual classroom function effectively. Quantification, I suggest, may be useful for the professional interests of educational researchers but it can be devastating in its consequences for school and society.", -- Statistics, -- educational research, -- history of education,,,,text,"Labaree, David F.",,,,,,,,,,,2010, +wt654sd9926,,Teaching Teachers to Build Equitable Classrooms,"Whether they are the outcome of global immigration trends, residential living patterns, or educational reform efforts such as detracking, heterogeneous classrooms pose considerable pedagogical challenges for educators. This article describes a systemic approach to restructuring the classroom with the goal of establishing and maintaining an equitable environment by creating curriculum, instruction, and assessments deliberately and purposefully to address the range of previous academic achievement and academic skills, the linguistic variability, and the intellectual diversity found in heterogeneous classrooms. A reconceptualization of intellectual competence, academic ability, or just plain being smart is at the core of teachers' efforts to build equitable classrooms. In practice, to narrow the achievement gap and to build equitable classrooms, teachers need to work toward equal-status, balanced interaction among students working together in small learning groups. The article also details the necessary conditions for teachers to learn and to practice equitable pedagogy.", -- detracking, -- educational change, -- emigration, -- immigration, -- mixed ability grouping, -- tracking,text,"Lotan, Rachel",Taylor & Francis Group,,,,,,,,,,2006, xf441kz3923,ETD,Toward a Theory of Generative Change: In Culturally and Linguistically Complex Classrooms,"This article situates the preparation of teachers to teach in culturally and linguistically complex classrooms in international contexts. It investigates long-term social and institutional effects of professional development and documents processes that facilitate teachers' continued learning. Data from a decade-long study of U.S. and South African teachers supported a model of generative change that explained how professional development could be internalized by teachers, subsequently serving as a heuristic to help them organize their individual programs of instruction. Drawing primarily on two case studies, this article documents teachers' development of generative knowledge and illustrates how they drew on that knowledge in thinking about students and teaching. The results were to facilitate generative thinking on the part of their students as well.", -- culturally and linguistically complex classrooms, -- generative change, -- professional development, -- writing as a pedagogical tool,,,text,"Ball, Arnetha",American Educational Research Association,,,,,,,,,,2009, xj025pz5558,ETD,Learning-Related Behaviors and Literacy Achievement in Elementary School-Aged Children,"This longitudinal study investigated associations between children's learning-related behaviors and literacy achievement in an ethnically diverse sample of low-income children throughout elementary school. Children's literacy and learning-related behavior (e.g., working independently, seeking challenges) were assessed when they were in kindergarten or first grade and again in the third and fifth grades. The results showed fair consistency over time in both learning-related behaviors and literacy skills. Learning-related behaviors in one grade predicted literacy achievement in the subsequent grade in which it was assessed, but literacy skills did not predict subsequent learning-related behaviors.", -- Elementary School-Aged Children, -- Literacy Achievement,,,,,text,"Stipek, Deborah","Chudgar, Amita","Newton, Stephen",,,,,,,,,2010, -xs752pb4545,ETD,What schools can’t do,"Americans have a long history of pinning their hopes on education as the way to realize compelling social ideals and solve challenging social problems. We want schools to promote civic virtue, economic productivity, and social mobility; to alleviate inequalities in race, class, and gender; to improve health, reduce crime, and protect the environment. So we assign these social missions to schools, and educators gamely accept responsibility for carrying them out. When the school system inevitably fall far short of these goals, we initiate a wave of school reform to realign the institution with its social goals and ramp up its effectiveness in attaining them. The result, as one pair of scholars has put it, is that educational reform in the U.S. is “steady work.” In this lecture, I want to tell a story: What history tells us about what schools cannot do. At its heart, this is a story grounded in paradox. On the one hand, American schooling has been an extraordinary success. It started as a small and peripheral enterprise in the 18th century and grew into a massive institution at the center of American society in the 21st, where it draws the lion’s share of the state budget and a quarter of the lives of citizens. Central to its institutional success has been its ability to embrace and embody the social goals that have been imposed upon it. Yet, in spite of continually recurring waves of school reform, education in the U.S. has been remarkably unsuccessful at implementing these goals in the classroom practices of education and at realizing these goals in the social outcomes of education. America, I suggest, suffers from a school syndrome. We have set our school system up for failure by asking it to fix all of our most pressing social problems, which we are unwilling to address more directly through political action rather than educational gesture. Then we blame the system when it fails. Both as a society and as individuals, we vest our greatest hopes in an institution that is manifestly unsuited to realizing them. In part the system’s failure is the result of a tension between our shifting social aims for education and the system’s own organizational momentum. We created the system to solve a critical social problem in the early days of the American republic, and its success in dealing with this problem fooled us into thinking that we could redirect the system toward new problems as time passed. But the school system has a mind of its own, and trying to change its direction is like trying to do a U-turn with a battleship. Today I will explore the failure of school reform to realize the central social goals that have driven it over the years. And at the end I explore the roots of schooling’s failure in its role as an agent of social reform.", -- School reform, -- purposes of schooling, -- functions of schooling, -- Graduate School of Education,,,text,"Labaree, David F.",,,,,,,,,,,2009, -xv245pv1701,ETD,Dual Language Learners - Effective Instruction in Early Childhood,"Concern over the achievement of this population of students has led to a large number of recent research reviews and professional publications aimed at improving preschool DLL's [dual language learners] educational opportunities. In this article, we survey the growing body of research to help inform educators responsible for creating settings for our young DLLs. We organize our review of the research by addressing four key topics: 1. Employing children's home language in the early childhood curriculum; 2. Comparing effective practices for DLLs and English speakers in English-only programs; 3. Promoting language development in English and the home language; and 4. Involving families in supporting children's language learning.", -- English, -- multilingual, -- early childhood, -- Graduate School of Education,,,text,"Goldenberg, Claude","Hicks, Judy","Lit, Ira",,,,,,,,,2014-10-08, +xs752pb4545,ETD,What schools can’t do,"Americans have a long history of pinning their hopes on education as the way to realize compelling social ideals and solve challenging social problems. We want schools to promote civic virtue, economic productivity, and social mobility; to alleviate inequalities in race, class, and gender; to improve health, reduce crime, and protect the environment. So we assign these social missions to schools, and educators gamely accept responsibility for carrying them out. When the school system inevitably fall far short of these goals, we initiate a wave of school reform to realign the institution with its social goals and ramp up its effectiveness in attaining them. The result, as one pair of scholars has put it, is that educational reform in the U.S. is “steady work.” In this lecture, I want to tell a story: What history tells us about what schools cannot do. At its heart, this is a story grounded in paradox. On the one hand, American schooling has been an extraordinary success. It started as a small and peripheral enterprise in the 18th century and grew into a massive institution at the center of American society in the 21st, where it draws the lion’s share of the state budget and a quarter of the lives of citizens. Central to its institutional success has been its ability to embrace and embody the social goals that have been imposed upon it. Yet, in spite of continually recurring waves of school reform, education in the U.S. has been remarkably unsuccessful at implementing these goals in the classroom practices of education and at realizing these goals in the social outcomes of education. America, I suggest, suffers from a school syndrome. We have set our school system up for failure by asking it to fix all of our most pressing social problems, which we are unwilling to address more directly through political action rather than educational gesture. Then we blame the system when it fails. Both as a society and as individuals, we vest our greatest hopes in an institution that is manifestly unsuited to realizing them. In part the system’s failure is the result of a tension between our shifting social aims for education and the system’s own organizational momentum. We created the system to solve a critical social problem in the early days of the American republic, and its success in dealing with this problem fooled us into thinking that we could redirect the system toward new problems as time passed. But the school system has a mind of its own, and trying to change its direction is like trying to do a U-turn with a battleship. Today I will explore the failure of school reform to realize the central social goals that have driven it over the years. And at the end I explore the roots of schooling’s failure in its role as an agent of social reform.", -- School reform, -- purposes of schooling, -- functions of schooling, -- Graduate School of Education,,,text,"Labaree, David F.",,,,,,,,,,,2009, +xv245pv1701,ETD,Dual Language Learners - Effective Instruction in Early Childhood,"Concern over the achievement of this population of students has led to a large number of recent research reviews and professional publications aimed at improving preschool DLL's [dual language learners] educational opportunities. In this article, we survey the growing body of research to help inform educators responsible for creating settings for our young DLLs. We organize our review of the research by addressing four key topics: 1. Employing children's home language in the early childhood curriculum; 2. Comparing effective practices for DLLs and English speakers in English-only programs; 3. Promoting language development in English and the home language; and 4. Involving families in supporting children's language learning.", -- English, -- multilingual, -- early childhood, -- Graduate School of Education,,,text,"Goldenberg, Claude","Hicks, Judy","Lit, Ira",,,,,,,,,2014-10-08, xz483fw4636,ETD,Patterns of Hispanic Students' Math Skill Proficiency in the Early Elementary Grades,"In this paper, we describe patterns of Hispanic students' math skill development during elementary school using data from a nationally-representative sample of Hispanic students assessed in math skills from kindergarten through fifth grade. Several robust patterns are evident. First, Hispanic students enter kindergarten with average math skills significantly lower than those of native-born, non-Hispanic White students, and similar to those of native-born non-Hispanic Black students. Second, Hispanic-White math proficiency gaps narrow from the start of kindergarten through fifth grade, but do not disappear. Third, there is considerable variation in average math skills among Hispanic population subgroups, with recent immigrants and lower-SES groups (Mexican and Central American students particularly) exhibiting the lowest levels of math skill through elementary school. Fourth, a simple measure of family socioeconomic status accounts for most of the Hispanic-White gaps that remain by fifth grade. Fifth, Hispanic students with the least English exposure and proficiency in kindergarten have considerably lower math proficiency rates at the start of kindergarten than English-proficient Hispanic students and students from homes where English is spoken. However, students from non-English speaking homes and students who are not proficient in spoken English at the start of kindergarten also exhibit more rapid gains in math skills during elementary school than do English-proficient Hispanic students and students from homes where English is spoken.", -- elementary, -- hispanic, -- latino, -- math,,,text,"Reardon, Sean"," Galindo, Claudia ",Taylor & Francis Group,National Task Force on Early Childhood Education for Hispanics,Foundation for Child Development,A.L. Mailman Family Foundation,Marguerite Casey Foundation,Peppercorn Foundation,Winthrop Rockefeller Foundation,Carnegie Scholars Program of the Carnegie Corporation of New York,AERA Research Grants Program,2007, yg867nn1610,ETD,Acculturative Stress and Coping,"This study examined acculturative stress and coping among 86 university students of Korean heritage. Participants indicated their stress levels on 3 scales of cultural adaptation: discrimination, language and cultural ties, and social distance. Findings showed that Korean self-identified students displayed higher levels of acculturative stress than Korean Americans on most measures. In particular, Korean identified males experience the greatest amount of general acculturative stress overall, especially with regard to language and cultural ties and to discrimination. Gender differences showed that women used collectivistic responses in coping with acculturative stress. Case studies were also conducted with 5 participants to enrich the quantitative findings. Using quantitative and qualitative data from the case studies, we use cultural explanations of traditional gender roles to understand our findings. Implications for university counselors who work with international students from South Korea are addressed.", -- acculturative stress, -- Korean heritage students, -- discrimination, -- international students, -- gender differences,,text,"Lee, Diane Sookyoung","Padilla, Amado M.",American College Personnel Association,,,,,,,,,2013-04, yk761rt2367,ETD,Parental involvement and the academic achievements of Hispanic students: Community literacy resources and home literacy practices among immigrant Latino families,"This paper reports relationships among communities, families, and Spanish-speaking children's language and literacy development in kindergarten and grade 1. Findings from a study of 35 communities show that communities with greater concentrations of Latinos are less likely to have printed materials, and available materials are more likely to be in Spanish. Communities with higher income and education levels have more literacy materials in English. Contrary to predictions, there are few associations among community literacy resources, frequency of children's home reading activities, and children's literacy achievement. This lack of association is due to within-community variation in home literacy practices and to schools' impact on home literacy. However, there are associations among community and family language characteristics and child literacy outcomes in Spanish and English, suggesting that at least in the early stages of literacy development, communities' influence on Spanish-speaking children's literacy development is through language-learning opportunities rather than literacy-learning opportunities per se.", -- bilingual, -- community, -- family, -- language, -- literacy,,text,"Reese, Leslie","Goldenberg, Claude ","The Haworth Press, Inc.",,,,,,,,,2008, diff --git a/spec/lib/importer/csv_importer_spec.rb b/spec/lib/importer/csv_importer_spec.rb index f3b549be8..a172bbc01 100644 --- a/spec/lib/importer/csv_importer_spec.rb +++ b/spec/lib/importer/csv_importer_spec.rb @@ -5,9 +5,16 @@ context 'when the model is passed' do let(:csv_file) { "#{fixture_path}/csv/gse_metadata.csv" } - let(:importer) { described_class.new(csv_file, image_directory, GenericWork) } + let(:importer) { described_class.new(csv_file, image_directory, fallback_class) } + let(:fallback_class) { Class.new { def initialize(_x, _y); end } } + let(:factory) { double(run: true) } + + # note: 2 rows do not specify type, 17 do it 'creates new works' do - expect(importer).to receive(:create_fedora_objects).exactly(19).times + expect(fallback_class).to receive(:new) + .with(any_args).and_return(factory).exactly(2).times + expect(Importer::Factory::ETDFactory).to receive(:new) + .with(any_args).and_return(factory).exactly(17).times importer.import_all end end