Coder Social home page Coder Social logo

aspace_reporting's Introduction

Archivesspace Report Script

This script runs through variety of data linked accession objects in archivesspace. It does this using SQL and Ruby to format the item into excel spreadsheets. This script was written for a yearly use and getting items out that were needed for Libraries reporting.

Dependencies

  • Archivesspace >= 2.0.1
  • Ruby >= 2.3.3

GEMS

  • Mysql2
  • RubyXL

How to Use

refer to the init.rb file

#!/usr/bin/env ruby

# gems 
require 'mysql2'
require 'rubyXL'

# require lib folder
Dir['./lib/*.rb'].each {|file| require file }

# set the root as a constant global
root = File.dirname(__FILE__)

# grabs the sql file you want to get form the database to put into the excel file
sql_file = FileHelper.new("#{root}/sql/accessions_report.sql")
sql = sql_file.get_file_contents.to_s

# connect to db 
@db = Database.new
sql_data = @db.query(sql).to_a

# generate report 
report = AccessorReport.new
report.excel_file = "#{root}/exports/report.xlsx"
report.create_workbook
report.sql_data = sql_data
report.write_to_workbook
report.write_headers
report.save_workbook

puts "Everything worked congrats!"

Using a command line window change directory into the root of this repository. Then run the command ruby init.rb. Make sure you have your database set up, to avoid working on a production database I made a database dump of the production database and uploaded it to a docker container on my local machine. I would recommend some solution like this so your not having to worry about the production data.

Contributing

This can be done in the form of documentation, code, or submitting bugs.

If you notice a way to improve this code, or want contribute your work back to the repository. You may do so by forking the repository and putting in a pull-request with changes you have made.

Open Source

This is open source, you can copy, read, modify, fork, etc without telling the West Virginia University Library. The various gems, programming languages, and other depdendencies may have other liscensing.

aspace_reporting's People

Contributors

ddavisgraphics avatar donrichards avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.