Giter VIP home page Giter VIP logo

Comments (5)

aaronrudkin avatar aaronrudkin commented on July 29, 2024

I agree 100% with the concept and it looks like the code is right! 👍

Three questions:

  1. Would we prefer to keep slope/intercept and calculate mid/spread, or the reverse?

  2. I think the title might be slightly mis-named. we're not talking about moving the code from model to view; we're talking about moving the code from static precalculation in the db into the model. Typically the view should not do anything in MVC or similar architectures. We're pretty fast and loose about how we implement MVC but still.

I would imagine that this would be added into the searchVotes/downloadVotes API as something that's done while assembling votes?

  1. Are there any metadata, dump, or db scripts that depend on both sets of data being available? If so, we'll have to update those as well as the WebVoteView stuff.

from webvoteview.

lukesonnet avatar lukesonnet commented on July 29, 2024
  1. Mid-spread are what come straight out of Keith's DW-NOMINATE and pynominate as they are currently written. Of course, rewriting pynominate is no problem, and having the slope and intercept being computed when the numbers are being ingested into the DB upon updates or conditional estimation is also no problem. However, you can generate the slope and the intercept from the midpoint and the spread them but the reverse is not true. The DB should probably have the mid/spread instead of slope/intercept.

  2. One problem with adding it to downloadVotes is if we intend to pull straight from mongo... then we have the same problem where we duplicate this kind of code. I don't know the issues with storing more information in the DB but I think this should remain as a static precalculation in to the DB. The mid/spread will be updated every time we run nominate, so we might as well just reingest it along with the mid/spread. Then this code only lives in one place.

Again, I don't know about the costs to large dbs in mongo.

from webvoteview.

aaronrudkin avatar aaronrudkin commented on July 29, 2024

There shouldn't be much penalty besides if we are querying by these fields (we don't) or indexing them (we don't). The main issue raised would be Adam's suggestion that the mid/spread and slope/intercept might be desynced due to people failing to sync them.

from webvoteview.

adamboche avatar adamboche commented on July 29, 2024

Aaron - I agree about the terminology.

Having both in the db shouldn't be a problem in terms of performance. In
general, we want to avoid duplicating (1) code and (2) data. In the ideal,
whatever database schema we use should therefore avoid redundant data like
having only mid/spread, not also slope/intercept. Then to avoid duplicating
code, a function could be introduced into the api that generates the
slope/intercept as needed. Then any routine that wants slope/intercept
could go through that api procedure to get them.

On Thu, Sep 22, 2016 at 4:00 PM, Luke Sonnet [email protected]
wrote:

  1. Mid-spread are what come straight out of Keith's DW-NOMINATE and
    pynominate as they are currently written. Of course, rewriting pynominate
    is no problem, and having the slope and intercept being computed when the
    numbers are being ingested into the DB upon updates or conditional
    estimation is also no problem. However, you can generate the slope and the
    intercept from the midpoint and the spread them but the reverse is not
    true. The DB should probably have the mid/spread instead of slope/intercept.

  2. One problem with adding it to downloadVotes is if we intend to pull
    straight from mongo... then we have the same problem where we duplicate
    this kind of code. I don't know the issues with storing more information in
    the DB but I think this should remain as a static precalculation in to the
    DB. The mid/spread will be updated every time we run nominate, so we might
    as well just reingest it along with the mid/spread. Then this code only
    lives in one place.

Again, I don't know about the costs to large dbs in mongo.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#37 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AS6Qi1BRKQWImHv2wQMnF6qrhp5PhLdFks5qswiWgaJpZM4KEMna
.

from webvoteview.

aaronrudkin avatar aaronrudkin commented on July 29, 2024

This is done. The download votes API now deletes x, y, slope, and intercept from what it gets out of the database and then re-generates them using the above code (if spread/mid are present and valid). So everything on the dev server is using the above code, even on the old schema, and we'll be ready for the new schema.

from webvoteview.

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.