The Research Repository

The Research Repository is a continuation or a sister project to Tropiary, the previous project I wrote for Flatiron school. I designed it for written projects, novels and short stories or non-fiction projects such as research papers, but in its current form it could be used for any project that requires research along several different subjects. It’s not quite as intuitive as I’d like it to be, but that may be a future problem, or a problem to address with writing clear directions on each new form page.

Functionally, each user has a profile constructed by their choice of login. Via Github (and the Omniauth project requirement), the user has a username based on their email address but does not have a display name. If you create an account directly you can create a username and a password, but you have no display name until you’re logged in and then can edit your profile. User creation requires a valid format email address, a username, and a password.

Once the user creates an account they have an option of creating a project or a list. A list can exist independently of a project, as it might be just a list of material the user wants to examine in further detail. The List object has many Projects and the Project object has many lists both through Topics. If the user chooses to create a project the options are simple: a project title, a project description (i.e. novel, research paper, essay), and a project summary. Having created a project, the user is then shunted to the project page showing the information and inviting the user to create a topic. This is where things become a bit complicated, and as my skills improve I intend to streamline it a bit. Each topic should be written in the context (and an example is given on the page) as it relates to the project. So, for example, a novel might have topics for the Protagonist’s hometown, the Protagonist’s childhood, the Antagonist’s background, and so on.

That done, the user may want to create a list for the topic. The ‘Create a List’ link takes the user to a page where they can give a list a name and select the topics they want to associate with that list. My test code has, for example, a list for 1930s Greenwich Village and a list for FTL (Faster Than Light) Travel. 1930s Greenwich Village is associated with only one project, through the topic of Main Setting. FTL Travel has two projects associated with it, through the topic Trade and Communication Structure for the project Triumvirate and through the topic Galactic Armada for the project Grumpy Old Mercs. And a list can always be edited to link it to a project via a topic if, for example, a user discovers that there’s a great deal of interest in research about snails and wants to write an informative essay or a listicle with pictures about it.

Once you have a list, you can now begin to add items! There are many fields to the item list but only two are required in validations: name and material. If we want to access the material we have to know what type it is, is it a book? a DVD? an audio file? a PDF? The rest are helpful, but not necessary. We can also, at the bottom of the page, add a source. The source can be a website, a library, a bookstore, a university press, anywhere you can source the material you’re looking for. Once the source exists you can then edit it to add a location or to change whether or not it’s free (such as a library or a web archive), and to add hours and a short description. I have not made the latter two options available for creating a source because the user might not immediately know these things and want to get the source entered in the database so as to remember to look it up later. However, once the source exists, a user can click on the ‘view all’  and be shown a list of sources with links to the individual pages, where the edit button exists. All sources are public, meaning you don’t have to be logged in to view them, and you can choose whether to view free sources or paywalled sources or all sources.

Most wish lists available on the web are bound to a single source: a single bookstore, a library, an audio archive. And even though Amazon is extensive, it isn’t the be-all and end-all of doing research. The main purpose behind this project is to create a single page where users can share sources or lists for various topics (the public/private toggle for lists is next on my coding goals, but was not necessary for the project) and exchange information about any subject they choose. 

Just Another Really Very Intelligent Song Suggester

A staple of my music purchasing process is going onto Amazon and complaining about how their algorithm won’t suggest anything I want to listen to, and that Spotify is hardly better. This is equal parts exaggeration and truth: Spotify’s recommendations are usually good, Amazon’s are not great. Had I but world enough and time, I’d like to pull together a music search engine where you could cross-reference by not only artist or genre but also recording label or studio, instrumentation, composer, songwriter, possibly even tour roster.

However, this is a code camp project with a necessarily limited scope, I was working to outside-imposed objective rather than my own overly ambitious goals. The objective was this: write a CLI Ruby gem to interact with a user and deliver data scraped from a website or called via API (Application Programming Interface) based on the user’s specifications.

Even with a narrowed scope I started out trying somewhat more than I could do. I wrote up a CLI that greeted the user and asked for input based on a choice of music selectors, two of which (instrumentation and composer) were not, as it turned out, standard on Bandcamp album or artist sites. Alas. So my choices were down to search by artist or search by genre. At this point it probably could have been done by If-Else statements, but I’d started out with Case statements instead with the expectation that I’d have several criteria to present to a user to pick from, and I opted not to change that for no functional reason. Using Case statements would allow me to expand in the future if Bandcamp changed their formatting or if I decided to use other websites, or for other reasons was able to search by more criteria, so the Case statements stayed.

Bandcamp artist pages don’t necessarily have tags, but all of the album pages I visited did, so I prompted for an album and an artist. It may be expecting much of the user to have that information to hand these days, but if you’re sitting at a computer with CD in hand looking for similar music such a data gem could be helpful. With that information, reformated after input to provide the data gem with the correct Bandcamp URL to look for, the scrape could begin and present the user with a list of tags to choose from.

Alternatively, the user can opt to search by genre in a broader sense. Bandcamp also sorts their offerings into genres accessible via the search bar, and since their genres are a mixture of conventional music genres and newer, less conventional ones, I included a step between selecting a genre and receiving the list of artists where the user can view a definition of the genre they’re looking into. “Rock” music as a concept carries a definite expectation of a certain sound, “Ambient” or “Experimental” as labels are less clear.

In both branches of the decision tree the ultimate result is the same: a final scrape to pull artists from the Bandcamp landing page for that genre whether selected by broad category name or tag assigned to an album and present them to the user for further study. Future versions of the program might include choosing from the sub-genre tags or even scraping from a second site (Wikipedia, maybe) to find more information on that artist or band. Even further into the future I’d like to pull together a program that searches through YouTube Music, Amazon, Bandcamp, MySpace, Wikipedia, and other sites to present information to a user about an artist’s projects, a list of projects involving a specific instrument combination, a recording studio’s albums involving a specific sound mixer, or any equally arcane combination of factors. But for now, I’m satisfied with sorting through Bandcamp.