Code Monkey home page Code Monkey logo

Comments (2)

Lyrratic avatar Lyrratic commented on June 8, 2024

Hello! If you're still accepting contributions, I'd be happy to take this on.

One clarification question: it looks like previously art has mostly been added by scraping sanjoseca.gov and assigning IDs at that point; as part of this change, would we need a way to programmatically assign IDs to manually added artwork listings?

from heartofthevalley.

Kyle-Falconer avatar Kyle-Falconer commented on June 8, 2024

@Lyrratic the ID is currently a SHA256 hash of the artist, title, and sourceURL fields, separated by a hyphen and prefixed with art_.

This is completely arbitrary and can be changed if needed, the only requirements are that it is unique for every art object and that it can be one-way hashed for repeatable IDs the next time it is scraped. The one-way hash is important because this allows for the art objects in the artworks-overrides.json file to be matched with the scraped version. The code is here:

generateID() {
this.id = 'art_'+(SHA256(`${this.properties.artist}-${this.properties.title}-${this.properties.sourceURL}`).toString());
}

If you're planning to create this JSON file manually, you could call the generateID() function call on each art item just that file before it is consolidated with the other artwork on this step:

}).then(() => {
return ArtworkScraper.mergeArtworksIntoFile(PATHS.PATH_CONSOLIDATED_ARTWORKS, [
PATHS.PATH_SCRAPED_ARTWORKS,
PATHS.PATH_ARTWORKS_OVERRIDES
]);

Alternatively, you could do the artwork generation manually in the command line for each one (it looks like there are only about 30 to do from that website):

echo -n "someartist-sometitle-https://example.com/sometitle" | shasum -a 256

from heartofthevalley.

Related Issues (20)

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.