diff --git a/Gemfile b/Gemfile index 0127e4fd..5f3f3fb8 100644 --- a/Gemfile +++ b/Gemfile @@ -106,6 +106,9 @@ gem 'bibtex-ruby' gem 'citeproc-ruby' gem 'csl-styles' +# Data import +gem 'roo' # Read CSV, XLSX, XLSM, ODS + # Session store backed by an Active Record class to avoid cookie overflow with # lasso gem 'activerecord-session_store' diff --git a/Gemfile.lock b/Gemfile.lock index dddd7992..4210adbd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -383,6 +383,9 @@ GEM actionpack (>= 5.2) railties (>= 5.2) rexml (3.3.9) + roo (2.10.1) + nokogiri (~> 1) + rubyzip (>= 1.3.0, < 3.0.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -549,6 +552,7 @@ DEPENDENCIES rack-brotli rails (~> 7.2) redis (~> 4.0) + roo rspec-rails (~> 7.0.0) rubocop rubocop-rails diff --git a/app/models/context.rb b/app/models/context.rb index 648be373..4f8832c0 100644 --- a/app/models/context.rb +++ b/app/models/context.rb @@ -26,8 +26,8 @@ class Context < ApplicationRecord has_many :samples has_many :c14s, through: :samples has_many :typos, through: :samples - has_paper_trail + include Versioned acts_as_copy_target # enable CSV exports def self.label diff --git a/app/models/material.rb b/app/models/material.rb index c3e0299b..3f66bf5d 100644 --- a/app/models/material.rb +++ b/app/models/material.rb @@ -20,10 +20,10 @@ class Material < ApplicationRecord using: { tsearch: { prefix: true } } # match partial words has_many :samples, inverse_of: :material - has_paper_trail validates :name, presence: true + include Versioned acts_as_copy_target # enable CSV exports def self.label diff --git a/app/models/typo.rb b/app/models/typo.rb index b694473b..fa162ba1 100644 --- a/app/models/typo.rb +++ b/app/models/typo.rb @@ -19,7 +19,7 @@ class Typo < ApplicationRecord include XronosDataHelper - has_paper_trail + include Versioned acts_as_copy_target # enable CSV exports validates :name, presence: true diff --git a/db/import/wang_et_al_2014/1-s2.0-S0277379114001966-mmc3.xlsx b/db/import/wang_et_al_2014/1-s2.0-S0277379114001966-mmc3.xlsx new file mode 100644 index 00000000..a09f45a4 Binary files /dev/null and b/db/import/wang_et_al_2014/1-s2.0-S0277379114001966-mmc3.xlsx differ diff --git a/db/import/wang_et_al_2014/wang_et_al_2014_references.csv b/db/import/wang_et_al_2014/wang_et_al_2014_references.csv new file mode 100644 index 00000000..0ff914a6 --- /dev/null +++ b/db/import/wang_et_al_2014/wang_et_al_2014_references.csv @@ -0,0 +1,122 @@ +Citation,Reference +Aldenderfer&Zhang.2004,"Aldenderfer M, Zhang YN. 2004. The Prehistory of the Tibetan Plateau to the Seventh Century A.D.: Perspectives and Research From China and theWest Since 1950. Journal of World Prehistory, 18(1):1-55." +Atahan et al.2011a,"Atahan P, Dodson J, Li XQ et al. 2011a. Early Neolithic diets at Baijia, Wei River valley, China: stable carbon and nitrogen isotope analysis of human and faunal remains. Journal of Archaeological Science,38:2811-2817." +Atahan et al.2011b,"Atahan P, Dodson J, Li XQ et al. 2011b. Subsistence and the isotopic signature of herding in the Bronze Age Hexi Corridor,NW Gansu, China. Journal of Archaeological Science, 38:1747-1753." +Barton et al.2007,"Barton L, Brantingham PJ, Ji DX. 2007. Late Pleistocene climate change and Paleolithic cultural evolution in northern China: Implications from the Last Glacial Maximum. Developments in Quaternary Sciences, 9:105-128." +Barton et al.2009,"Barton L, Newsome SD, Chen FH et al. 2009. Agricultural origins and the isotopic identity of domestication in northern China. PNAS, 106(14): 5523-5528. Support information." +Barton.2009,"Barton L. 2009. Early Food Production in China’s Western Loess Plateau. PhD thesis (University of California, Davis)." +Barton.2009.,"Barton L. 2009. Early Food Production in China’s Western Loess Plateau. PhD thesis (University of California, Davis)." +Boaretto et al.2009,"Boaretto E, Wu XH, Yuan JR et al. 2009. Radiocarbon dating of charcoal and bone collagen associated with early pottery at Yuchanyan Cave,Hunan Province, China. PNAS,106(24):9595-9600." +Brantingham et al.2003,"Brantingham PJ, Ma HZ, Olsen JW et al. 2003. Speculation on the timing and nature of Late Pleistocene hunter-gatherer colonization of the Tibetan Plateau.Chinese Science Bulletin ,48(14):1510-1516" +Cao et al.2007,"Cao ZH, Yang LZ, Lin XG et al. 2007. Morphological characteristics of paddy fields, paddy soil profile, phytolith and fossil rice grain of the Neolithic age in Yangtze River Delta. Acta Pedologica Sinica, 44(5):838-847." +Chen et al.1992,"Chen JL, Yang JC, Sun BJ et al. 2009. Manufacture technique of bronze-iron bimetallic objects found in M27 of Liangdaicun Site, H ancheng, Shaanxi. Science China(E), 52(10):3038-3045." +Chen et al.2009,"Chen TM,R.E.M Hedges,Yuan ZX.1992.The second batch of accelerator radiocarbon dates for upper cave of Zhoukoudian.Acta Anthropologica Sinica,11(2):112-116." +Ding et al.2013,"Ding XF, Shen CD, Ding P et al. 2013. New radiocarbon dates for Milu (Elaphurus davidianus) sub-fossils from southeast China. Nuclear Instruments and Methods in Physics Research B, 294: 627-630." +Dodson et al.2013,"Dodson JR, Li XQ, Zhou XY et al. 2013. Origin and spread of wheat in China. Quaternary Science Reviews,72:108-111." +Dong et al.2012,"Dong GH, Jia X, An CB et al. 2012. Mid-Holocene climate change and its effect on prehistoric cultural evolution in eastern Qinghai Province, China. Quaternary Research,77:23-30." +Dong et al.2013a,"Dong GH, Jia X, Elston R et al. 2013a. Spatial and temporal variety of prehistoric human settlement and its influencing factors in the upper Yellow River valley, Qinghai Province, China. Journal of Archaeological Science, 40(5):2538-2546." +Dong et al.2014,"Dong GH, Wang ZL, Ren LL et al. 2014. A comparative study of 14C dating on charcoal and charred seeds from Late Neolithic and Bronze Age sites in Gansu and Qinghai Provinces, NW China. Radiocarbon, 56:157-163." +Flad et al.2010,"Flad R, Li SC, Wu XH et al. 2010. Early wheat in China: results from new studies at Donghuishan in the Hexi Corridor. The Holocene, 20(6):955-965." +Gao et al.2008,"Gao X, Yuan BY, Pei SW et al. 2008. Analysis of sedimentary-geomorphologic variation and the living environment of hominids at the Shuidonggou paleolithic site. Chinese Science Bulletin, 53:2025-2032." +Gideon Shelach.2000,"Gideon Shelach. 2000. The Earliest Neolithic Cultures of Northeast China: Recent Discoveries and New Perspectives on the Beginning of Agriculture. Journal of World Prehistory, 14(4):363-413." +Gong et al.2011,"Gong YW, Yang YM, Ferguson DK et al. 2011. Investigation of ancient noodles, cakes, and millet at the Subeixi Site, Xinjiang,China. Journal of Archaeological Science,38(2):470-479." +Grawford et al.2006,"Grawford G, Chen XX, Wang JH. 2006. Houli culture rice from the Yuezhuang Site, Jinan. East Asia Archaeology(Ⅲ): 247–251." +Guan et al.2013,"Guan YJ, Xiong ZM, Ruan XD et al. 2013. Evidences for the view of the importance of Hepu seaport in ancient China. Nuclear Instruments and Methods in Physics Research Section B, 294:688-691." +Hao et al.2001,"Hao SG, Ma XP, Xia ZK et al. 2002. The early Holocene loess section in the Donghulin site near Zhaitang in Beijing. Acta Geologica Sinica, 76(3):420-430." +Hao et al.2002,"Hao SG, Ma XP, Yuan SX et al. 2001. The Donghulin Woman from western Beijing:14C age and an associated compound shell necklace. Antiquity,75:517-522." +Hou et al.2012,"Hou GL, Lai ZP, Sun YJ et al. 2012. Luminescence and radiocarbon chronologies for the Xindian Culture site of Lamafeng in the Guanting Basin on the NE edge of the Tibetan Plateau. Quaternary Geochronology,10:394-398." +Innes et al.2009,"Innes JB, Zong YQ, Chen ZY et al. 2009. Environmental history, palaeoecology and human activity at the early Neolithic forager/cultivator site at Kuahuqiao, Hangzhou, eastern China. Quaternary Science Reviews,28:2277-2294." +"Institute of Archaeology, Chinese Academy of Social Sciences et al.2003","Institute of Archaeology, Chinese Academy of Social Sciences et al. 2003. Guilin Zengpiyan. Beijing: Cultural Relics Press." +"Institute of Archaeology, Chinese Academy of Social Sciences.1991","Institute of Archaeology, Chinese Academy of Social Sciences.1991.Radiocarbon dates in Chinese Archaeology (1965-1991). Beijing: Cultural Relics Press." +"Institute of Archaeology, Chinese Academy of Social Sciences.1992","Institute of Archaeology, Chinese Academy of Social Sciences.1992.Report of 14C dates(ⅩⅨ).Kaogu(Archaeology),7:655-662 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1993","Institute of Archaeology, Chinese Academy of Social Sciences.1993.Report of 14C dates(ⅩⅩ).Kaogu(Archaeology),7:645-649 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1994","Institute of Archaeology, Chinese Academy of Social Sciences.1994.Report of 14C dates(ⅩⅩⅠ).Kaogu(Archaeology),7:662-664 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1995","Institute of Archaeology, Chinese Academy of Social Sciences.1995.Report of 14C dates(ⅩⅩⅡ).Kaogu(Archaeology),7:655-659 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1996","Institute of Archaeology, Chinese Academy of Social Sciences.1996.Report of 14C dates(ⅩⅩⅢ).Kaogu(Archaeology),7:66-70 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1997","Institute of Archaeology, Chinese Academy of Social Sciences.1997.Report of 14C dates(ⅩⅩⅣ).Kaogu(Archaeology),7:35-52 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.1999","Institute of Archaeology, Chinese Academy of Social Sciences.1999.Report of 14C dates(ⅩⅩⅤ).Kaogu(Archaeology),7:80-83 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2000","Institute of Archaeology, Chinese Academy of Social Sciences.2000.Report of 14C dates(ⅩⅩⅥ).Kaogu(Archaeology),7:70-74 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2001","Institute of Archaeology, Chinese Academy of Social Sciences.2001.Report of 14C dates(ⅩⅩⅦ).Kaogu(Archaeology),7:82-86 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2002","Institute of Archaeology, Chinese Academy of Social Sciences.2002.Report of 14C dates(ⅩⅩⅧ).Kaogu(Archaeology),7:49-58 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2003","Institute of Archaeology, Chinese Academy of Social Sciences.2003.Report of 14C dates(ⅩⅩⅨ).Kaogu(Archaeology),7:64-68 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2004","Institute of Archaeology, Chinese Academy of Social Sciences.2004.Report of 14C dates(ⅩⅩⅩ).Kaogu(Archaeology),7:66-71 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2005","Institute of Archaeology, Chinese Academy of Social Sciences.2005.Report of 14C dates(ⅩⅩⅩⅠ).Kaogu(Archaeology),7:57-61 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2006","Institute of Archaeology, Chinese Academy of Social Sciences.2006.Report of 14C dates(ⅩⅩⅩⅡ).Kaogu(Archaeology),7:65-67 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2007","Institute of Archaeology, Chinese Academy of Social Sciences.2007.Report of 14C dates(ⅩⅩⅩⅢ).Kaogu(Archaeology),7:60-63 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2008","Institute of Archaeology, Chinese Academy of Social Sciences.2008.Report of 14C dates(ⅩⅩⅩⅣ).Kaogu(Archaeology),7:85-87 ." +"Institute of Archaeology, Chinese Academy of Social Sciences.2009","Institute of Archaeology, Chinese Academy of Social Sciences.2009.Report of 14C dates(ⅩⅩⅩⅤ).Kaogu(Archaeology),7:64-67 ." +"Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2010","Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2010.Report of 14C dates(ⅩⅩⅩⅥ).Kaogu(Archaeology),7:73-76 ." +"Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2011","Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2011.Report of 14C dates(ⅩⅩⅩⅦ).Kaogu(Archaeology),7:65-67 ." +"Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2012","Institute of Archaeology, Chinese Academy of Social Sciences&Institute of Earth Environment,Chinese Academy of Sciences.2012.Report of 14C dates(ⅩⅩⅩⅧ).Kaogu(Archaeology),7:88-91 ." +Institute of Cultural Relics and Archaeology of Hunan.2006,Institute of Cultural Relics and Archaeology of Hunan. 2006. Pengtoushan and Bashidang. Beijing: Science Press. +Institute of Cultural Relics in Henan Province.1999,Institute of Cultural Relics in Henan Province. 1999. Wuyang Jiahu. Beijing: Science Press. +Institute of Cultural Relics in Henan Province.2006,Institute of Cultural Relics in Henan Province. 2006. Yuzhou Wadian. Beijing: World Book Publishing Company. +Jia et al.2011,"Jia PWM, Betts A, Wu XH et al. 2011. New evidence for Bronze Age agricultural settlements in the Zhunge’er (Junggar) Basin,China. Journal of Field Archaeology,36(4):269-280." +Jia et al.2013,"Jia X, Dong GH, Li H et al. 2013. The development of agriculture and its impact on cultural expansion during the late Neolithic in the Western Loess Plateau, China. The Holocene, 23(1):85-92." +Jiang et al.2008,"Jiang HE, Wang B, Li X et al. 2008. A consideration of the involucre remains of Coix lacryma-jobi L.(Poaceae) in the Sampula Cemetery (2000 years BP), Xinjiang, China. Journal of Archaeological Science,35:1311-1316." +Jiang et al.2009,"Jiang HE, Wu Y, Wang HH et al. 2013. Ancient plant use at the site of Yuergou, Xinjiang, China:implications from desiccated and charred plant remains.Vegetation History and Archaeobotany, 22(2):129-140. " +Jiang et al.2013,"Jiang HE, Zhang YB, Li X et al. 2009. Evidence for early viticulture in China: proof of a grapevine (Vitis vinifera L., Vitaceae) in the Yanghai Tombs, Xinjiang. Journal of Archaeological Science,36:1458-1465." +Jin et al.2013,"Jin GY, Wu WW, Zhang KS et al. 2013. 8000-year old rice remains from the north edge of the Shandong Highlands, East China. Journal of archaeological science, in press." +Lee&Bestel.2007,"Lee GA, Bestel S. 2007. Contextual analysis of plant remains at the Erlitou-Period Huizui Site, Henan, China. Bulletin of the Indo-Pacific Prehistory, 27:49-60." +Lee et al.2007,"Lee GA, Crawford GW, Liu L et al. 2007. Plants and people from the Early Neolithic to Shang periods in North China. PNAS, 104(3):1087-1092." +Li F et al.2011,"Li F, Chen FY, Gao X et al. 2011. A report on the 2009 reconnaissance of Paleolithic remains in the Shuiluo and Qingshui River Valley, Gansu Province. Acta Anthropologica Sinica, 30(2):137-148." +Li F et al.2013a,"Li F, Chen FY, Gao X et al. 2013a. Dating of the Xujiacheng Paleolithic site in Gansu Province, North China. Acta Anthropologica Sinica, 32(2):1-10." +Li F et al.2013b,"Li F, Kuhn SL, Gao X et al. 2013b. Re-examination of the dates of large blad e technology in China: A compariso n of Shuidong gou Locality 1 and Locality 2. Journal of Human Evolution, 64:161-168." +Li et al.2008,"Li L, Zhu C, Lin LG et al. 2008. Transgression records between 7500-5400BC on the stratum of the Luotuodun site in Yixing, Jiangsu Province. Acta Geographica Sinica, 63(11):1189-1197." +Li ML et al.2010,"Li ML, Mo DW, Mao LJ et al. 2010.Paleosalinity in the Tianluoshan site and the correlation between the Hemudu culture and its environmental background. Journal of Geographical Sciences, 20(3):441-454." +Li X et al.2013,"Li X, Wagner M, Wu XH et al. 2013. Archaeological and palaeopathological study on the third/second century BC grave from Turfan, China: Individual health history and regional implications. Quaternary International, 290-291:335-343." +Li et al.2009,"Li XQ, Shang X, Dodson J et al. 2009. Holocene agriculture in the Guanzhong Basin in NW China indicated by pollen and charcoal evidence. The Holocene,19(8):1213-1220." +Li et al.2007,"Li XQ, Zhou XY, Zhou J et al. 2007. The earliest archaeobiological evidence of the broadening agriculture in China recorded at Xishanping site in Gansu Province. Science China(D), 50(11):1707-1714." +Li et al.2011,"Li YC, Xu QH, Duan HZ et al.2011. Environmental context of a Neolithic site at Beifudi, north-west Hebei Province,China. Journal of Archaeological Science, 38:2502-2508." +Li YY et al.2010,"Li YY, Wu J, Hou SF et al. 2010. Palaeoecological records of environmental change and cultural development from the Liangzhu and Qujialing archaeological sites in the middle and lower reaches of the Yangtze River. Quaternary International, 277:29-37." +Li YYet al.2010,"Li YY, Wu J, Hou SF et al. 2010. Palaeoecological records of environmental change and cultural development from the Liangzhu and Qujialing archaeological sites in the middle and lower reaches of the Yangtze River. Quaternary International, 277:29-37." +Liu et al.2005,"Liu KX, Han BX, Guo ZY et al. 2005. AMS Radiocarbon Dating of Bone Samples from The Xinzhai Site in China. Radiocarbon, 47(1):21-25." +Liu et al.2013,"Liu L, Bestel S, Shi JM et al. 2013. Paleolithic human exploitation of plant foods during the last glacial maximum in North China. PNAS,110(14):5380-5385." +Lu et al.2010,"Lu HY, Xia XC, Liu JQ et al. 2010.A preliminary study of chronology for a newly discovered ancient city and five archaeological sites in Lop Nor,China. Chinese Science Bulletin, 55:63-71." +Lu et al.2009,"Lu HY, Zhang JP, Liu KB et al. 2009. Earliest domestication of common millet (Panicum miliaceum) in East Asia extended to 10,000 years ago. PNAS,106(18):7367-7372." +Ma et al.2012,"Ma MM, Dong GH, Chen FH et al. 2012. Process of paleofloods in Guanting basin, Qinghai Province, China and possible relation to monsoon strength during the mid-Holocene.Quaternary International,doi:10.1016/j.quaint.2012.05.031." +Madsen et al.2006,"Madsen DB, Ma HZ, Brantingham PJ et al. 2006. The Late Upper Paleolithic occupation of the northern Tibetan Plateau margin. Journal of Archaeological Science,33:1433-1444." +Pan.2011,"Pan Y. 2011. Resource production in the Yangzi delta and Qiantang drainage from 10000 to 6000 BP: A palaeoethnobotanical and human ecological investigation. PhD Dissertation, Department of Cultural Heritage and Museology, Fudan University." +Panel of Xia-Shang-Zhou Chronology Project.2000,Panel of Xia-Shang-Zhou Chronology Project. 2000. Report of phased achievements of Xia-Shang-Zhou Chronology Project(1996-2000). Beijing:World Book Publishing Company. +Pei et al.2012,"Pei SW, Gao X, Wang HM et al. 2012. The Shuidonggou site complex: new excavations and implications for the earliest Late Paleolithic in North China. Journal of Archaeological Science, 39(12):3610-3626." +Peng et al.2012,"Peng F, Gao X, Wang HM et al. 2012. An engraved artifact from Shuidonggou, an Early Late Paleolithic Site in Northwest China. Chinese Science Bulletin, 57(1):1-6." +Qiu&Cai.2001,"Qiu SH,Cai LZ.2001.The radiocarbon chronology frame in Xia-Shang-Zhou Chronology Project.Kaogu(Archaeology),1:90-100." +Qiu et al.2012,"Qiu ZW, Zhang YB, Bedigian D et al. 2012. Sesame Utilization in China: New Archaeobotanical Evidence from Xinjiang. Economic Botany, 66(3):255-263." +Radiocarbon laboratory of Peking University.1996,"Radiocarbon laboratory of Peking University. 1996. Report of 14C dates(Ⅹ). Wenwu, 6:91-95." +Rhode et al.2007,"Rhode D, Zhang HY, Madsen DB et al. 2007. Epipaleolithic/early Neolithic settlements at Qinghai Lake, western China. Journal of Archaeological Science,34:600-612." +Richardin et al.2010,"Richardin P, Cuisance F, Buisson N et al. 2010. AMS radiocarbon dating and scientific examination of high historical value manuscripts: Application to two Chinese manuscripts from Dunhuang. Journal of Cultural Heritage ,11:398-403." +"School of Archaeology and Museology, Peking University.2006","School of Archaeology and Museology, Peking University et al. 2006. The Donghulin prehistoric site in Mentougou district, Beijing. Kaogu(Archaeology),7:3-8." +Shang et al.2012,"Shang X, Zhang PC, Zhou XY et al. 2012. The preliminary study of early Neolithic farming in Xiahe site,Shaanxi. Archaeology and Cultural Relics, 4:55-59." +Shu et al.2010,"Shu JW, Wang WM, Jiang LP et al. 2010. Early Neolithic vegetation history, fire regime and human activity at Kuahuqiao,Lower Yangtze River, East China: New and improved insight .Quaternary International, 227:10-21." +Sun&Li.2012,"Sun N, Li XQ. 2012. The quantitative reconstruction of the palaeoclimate between 5200 and 4300 cal yr BP in the Tianshui Basin, NW China. Climate of the Past, 8:625-636." +Sun.2010,"Sun ZY. 2010. The discovery of Pre-Zhou fruits-vegetables storage pit in Zhouyuan site and relational issues. Kaogu(Archaeology), 10:69-75." +Tong et al.2006,"Tong HW,Shang H,Zhang SQ et al.2006.Mammalian biostratigraphy of TianyuanCave, compared with that of Upper Cave at Zhoukoudian. Acta Anthropologica Sinica,25(1):68-81." +Wagner et al.2011,"Wagner M, Wu XH, Tarasov P et al. 2011. Radiocarbon-dated archaeological record of early first millennium B.C. mounted pastoralists in the Kunlun Mountains, China. PNAS,108(38):15733-15738." +Wang et al.2010,"Wang XK, Wei J, Chen QJ et al. 2010. A preliminary study on the excavation of the Jinsitai Cave Site. Acta Anthropologica Sinica, 29(1):15-32." +Wu et al.2007,"Wu XH, Fu LW, Li SC et al. 2007. The radiocarbon chronology of Zhongba site, Zhongxian, Chongqing. Kaogu(Archaeology), 7:80-91." +Wu&Wei.2009,"Wu XH, Wei XT. 2009. The radiocarbon dating and ages of relational remains of the Nanjiaokou site. In Institute of Cultural Relics in Henan Province (ed). Sanmenxia Nanjiaokou. Beijing: Science Press. 436-443." +Wu et al.2012,"Wu XH, Zhang C, Goldberg P et al. 2012. Early Pottery at 20,000 Years Ago in Xianrendong Cave, China. Scicece, 336:1696-1700." +Xia et al.2004,"Xia ZK, Wang ZH, Zhao QC. 2004. Extreme flood events and climate change around 3500 a BP in the Central Plains of China. Science China(D), 47(7):599-606." +Xia et al.2012,"Xia ZK, Zhang JN, Liu J et al. 2012. Analysis of the ecological environment around 10000 a BP in Zhaitang area, Beijing: A case study of the Donghulin Site .Chinese Science Bulletin, 57(4):360-369." +Xia et al.2010,"Xia ZK, Zhang XH, Chu XL et al. 2010. Discovery and significance of buried paleoearthquake of the early Shang Dynasty (1260–1520 BC) in Xuecun, Xingyang, Henan Province, China. Chinese Science Bulletin, 55(12):1186-1192." +Yao.2010,"Yao A. 2010. Recent Developments in the Archaeology of Southwestern China. Journal of Archaeological Research,18(3):203-239." +Yasuda et al.2004,"Yasuda Y, Fujiki T, Nasu H et al. 2004. Environmental archaeology at the Chengtoushan site,Hunan Province,China,and implications for environmental change and the rise and fall of the Yangtze River civilization.Quaternary International,123-125:149-158." +Yi et al.2011,"Yi MJ, Gao X, Zhang XL et al. 2011. A preliminary report on investigations in 2009 of some prehistoric sites in the Tibetan Plateau marginal region. Acta Anthropologica Sinica, 30(2):124-136." +Yuan et al.1998,"Yuan SX, Zhao CH, Zhu XD et al.1998. Research of the chronology and culture of Shizitan site in Jixian,Shanxi Province. Kaogu(Archaeology), 6:57-62." +Yuan et al.1994,"Yuan SX,Chen TM,Hu YQ et al. 1994. Report of 14C dates(Ⅸ). Wenwu,4:89-95." +Zhang&Hung.2008,"Zhang C, Hung HC. 2008. The Neolithic of Southern China–Origin,Development, and Dispersal. Asian Perspectives, 47(2):299-329." +Zhang et al.2011,"Zhang DJ, Chen FH, Ji DX et al. 2011. The age, lithics and paleoenvironmental study of the Sumiaoyuantou locality, Gansu Province. Acta Anthropologica Sinica, 30(3):289-298." +Zhang et al.2010,"Zhang JF, Huang WW, Yuan BY et al. 2010. Optically stimulated luminescence dating of cave deposits at the Xiaogushan prehistoric site, northeastern China. Journal of Human Evolution, 59:514-524." +Zhang et al.2011,"Zhang JF, Wang XQ, Qiu WL et al. 2011. The paleolithic site of Longwangchan in the middle Yellow River, China:chronology, paleoenvironment and implications. Journal of Archaeological Science,38:1537-1550." +Zhang et al.2012,"Zhang JP, Lu HY, Gu WF et al. 2012. Early Mixed Farming of Millet and Rice 7800 Years Ago in the Middle Yellow River Region, China. PLos ONE,7(12): e52146." +Zhang et al.2010,"Zhang JP, Lu HY, Wu NQ et al. 2010. Phytolith evidence for rice cultivation and spread in Mid-Late Neolithic archaeological sites in central North China. Boreas, 39(3):592-602." +Zhang et al.1999,"Zhang JZ, Harbottle G, Wang CS et al. 1999. Oldest playable musical instruments found at Jiahu early Neolithic site in China. Nature, 401:366-368. Supplementary Information." +Zhang et al.2010,"Zhang Y, Stiner MC, Dennell R et al. 2010. Zooarchaeological perspectives on the Chinese Early and Late Paleolithic from the Ma’anshan site (Guizhou, South China). Journal of Archaeological Science, 37:2066-2077." +Zhao&Wu.2000,"Zhao CH, Wu XH. 2000. The discovery and dating technique of early Chinese pottery and preliminary discussion on its technology. Journal of Ceramics, 21(4):228-234." +Zhao et al.2012,"Zhao KL, Li XQ, Zhou XY et al. 2012. Characteristics of agricultural activities and its impact on the environment at Xintala site,Xinjiang,reconstructed from archaeological plant remains. Quaternary Sciences, 32(2):219-225." +Zhao&Chen.2011,"Zhao ZJ, Chen J. 2011. The results of flotation and analysis of the Yingpanshan site, Maoxian, Sichuan. Cultural Relics in Southern China, 3:60-67." +Zheng et al.2011,"Zheng YF, Sun GP, Chen XG. 2011. Response of rice cultivation to fluctuating sea level during the M id-Holocene.Chinese Science Bulletin, 56(34):2888-2896." +Zheng et al.2009,"Zheng YF, Sun GP, Qin L et al. 2009. Rice fields and modes of rice cultivation between 5000 and 2500 BC in east China. Journal of Archaeological Science, 36:2609-2616." +Zhou et al.2004,"Zhou WJ, Liu L, Liu YH et al. 2004. Study on the ancient copper-mining and smelting relic site in Ruichang, Jiangxi by using 14C-AMS. Geochimica, 33(5):491-494." +Zhou et al.2012,"Zhou XY, Li XQ, Dodson J et al. 2012. Land degradation during the Bronze Age in Hexi Corridor (Gansu, China). Quaternary International, 254:42-48." +Zhou et al.2011,"Zhou XY, Li XQ, Zhao KL et al. 2011. Early agricultural de velopment and environm ental effects in the Neolithic Longdong basin ( East Gansu). Chinese Science Bulletin, 56:318-326." diff --git a/db/schema.rb b/db/schema.rb index 77dc5088..a26c9d42 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_11_29_163926) do +ActiveRecord::Schema[7.2].define(version: 2024_11_29_163926) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" enable_extension "plpgsql" diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake new file mode 100644 index 00000000..2a300b16 --- /dev/null +++ b/lib/tasks/import.rake @@ -0,0 +1,169 @@ +namespace :import do + + require "roo" + + admin_user_id = ENV["ADMIN_USER_ID"] + + desc "Import data from Wang et al. 2014" + task wang_et_al_2014: :environment do + dates_file = "db/import/wang_et_al_2014/1-s2.0-S0277379114001966-mmc3.xlsx" + references_file = "db/import/wang_et_al_2014/wang_et_al_2014_references.csv" + revision_comment = "Imported from Wang et al. (2014), " + + wang_et_al_2014_bibtex = BibTeX.parse <<-END +@article{WangEtAl2014, + title = {Prehistoric Demographic Fluctuations in {{China}} Inferred from Radiocarbon Data and Their Linkage with Climate Change over the Past 50,000 Years}, + author = {Wang, Can and Lu, Houyuan and Zhang, Jianping and Gu, Zhaoyan and He, Keyang}, + year = {2014}, + month = aug, + journal = {Quaternary Science Reviews}, + volume = {98}, + pages = {45--59}, + issn = {0277-3791}, + doi = {10.1016/j.quascirev.2014.05.015}, + abstract = {Historic human--climate interactions have been of interest to scholars for a long time. However, exploring the long-term relation between prehistoric demography and climate change remains challenging because of the absence of an effective proxy for population reconstruction. Recently, the summed probability distribution of archaeological radiocarbon dates has been widely used as a proxy for human population levels, although researchers recognize that such usage must be cautious. This approach is rarely applied in China due to the lack of a comprehensive archaeological radiocarbon database, and thus the relation between human population and climate change in China remains ambiguous. Herein we systematically compile an archaeological 14C database (n~=~4656) for China for the first time. Using the summed probability distributions of the radiocarbon dates alongside high-resolution palaeoclimatic records, we show that: 1) the commencement of major population expansion in China was at 9~ka~cal~BP, occurring after the appearance of agriculture and associated with the early Holocene climate amelioration; 2) the major periods of small population size and population decline, i.e., 46--43~ka~cal~BP, 41--38~ka~cal~BP, 31--28.6~ka~cal~BP, 25--23.5~ka~cal~BP, 18--15.2~ka~cal~BP, and 13--11.4~ka~cal~BP, correspond well with the dating of abrupt cold events in the Last Glacial (LG) such as the Heinrich and Younger Dryas (YD) events, while the major periods of high-level population in the Holocene, i.e., 8.5--7~ka~cal~BP, 6.5--5~ka~cal~BP and 4.3--2.8~ka~cal~BP, occur at the same times as warm-moist conditions and Neolithic cultural prosperity, suggesting that abrupt cooling in the climate profoundly limited population size and that mild climate episodes spurred a growth in prehistoric populations and advances in human cultures; and 3) populations in different regions experience different growth trajectories and that their responses to climate change are varied, due to both regional environmental diversity and the attainment of different levels of adaptive strategies.} +} + END + + PaperTrail.request(whodunnit: admin_user_id) do + ActiveRecord::Base.transaction do + + wang_et_al_2014 = Reference.find_or_create_by!( + short_ref: "Wang et al. 2014", + bibtex: wang_et_al_2014_bibtex.to_s + ) + + # Import references as references (manually matched to citations) + references = Roo::Spreadsheet.open(references_file) + .parse(headers: true) + + references_progress = ProgressBar.create( + title: "Importing references", + total: references.count, + format: "%t: |%B| %c/%C (%E)" + ) + + bibliography = references.map { |reference| + references_progress.increment + + # Correct punctuation in short refs + short_ref = reference["Citation"] + .sub(".", " ") + .sub("&", " & ") + .sub(",", ", ") + .sub("et al", "et al.") + .sub(", ", ", ") + + # Generate better-than-nothing BibTeX + bibtex = BibTeX::Entry.new( + bibtex_type: :misc, + bibtex_key: short_ref.remove(" ").remove(".").remove("&").remove(","), + note: reference["Reference"] + ) + + ref = Reference.find_or_create_by!(bibtex: bibtex, short_ref: short_ref) do |reference| + reference.revision_comment = revision_comment + end + + [ reference["Citation"], ref ] + }.to_h + + # Import dates as sites, contexts, samples, c14s, and typos + dates = Roo::Spreadsheet.open(dates_file) + .sheet("China") + .parse(headers: true, clean: true) + + dates_progress = ProgressBar.create( + title: "Importing dates", + total: dates.count, + format: "%t: |%B| %c/%C (%E)" + ) + + dates.each do |date| + dates_progress.increment + + if bibliography.has_key?(date["Data references"]) + references = [ + bibliography.fetch(date["Data references"]), + wang_et_al_2014 + ] + else + references = [ wang_et_al_2014 ] + end + + site_type = SiteType.find_or_create_by!(name: date["Site type"]) + + site = Site.find_or_create_by!( + country_code: "CN", + lat: date["Latitude(N)"], + lng: date["Longitude(E)"], + name: date["Site name"], + ) do |site| + site.site_types = [ site_type ] + site.references = references + site.revision_comment = revision_comment + end + + context = Context.find_or_create_by!( + name: date["Context"] || "Unspecified", + site: site + ) do |context| + context.revision_comment = revision_comment + end + + if date["Material dated"] == "Unknown" + material = nil + else + material = Material.find_or_create_by!(name: date["Material dated"]) do |material| + material.revision_comment = revision_comment + end + end + + sample = Sample.find_or_create_by!( + position_description: date["Sample provenience"], + context: context, + material: material + ) do |sample| + sample.revision_comment = revision_comment + end + + delta_c13 = date["Delta13C(‰)"] + delta_c13_std = nil + if delta_c13.is_a?(String) and delta_c13.include?("±") + delta_c13, delta_c13_std = delta_c13.split("±").map(&:to_i) + else + delta_c13 = delta_c13.to_i + end + + c14 = C14.find_or_create_by!( + bp: date["14C age(BP)"], + std: date["1σ"], + delta_c13: delta_c13, + delta_c13_std: delta_c13_std, + lab_identifier: date["Lab code"], + method: date["Method of Sample Analysis"], + sample: sample + ) do |c14| + c14.references = references + c14.revision_comment = revision_comment + end + + unless date["Cultural affiliation"].blank? + typo = Typo.find_or_create_by!( + name: date["Cultural affiliation"], + sample: sample + ) do |typo| + typo.references = references + typo.revision_comment = revision_comment + end + end + + end + + end + + end + + end + +end