Giter VIP home page Giter VIP logo

hitfactor.info's Introduction

HitFactor.Info

A Better Classification System for Action Shooting Sports

Project Goals

  1. Pick Data-Driven Recommended HHF for All Classifiers/Divisions.
  2. Implement Closer-To-Major-Match-Performance Classification Algorithm
  3. Provide Better Classification System or at least Partial Improvements to All Interested Action Shooting Sport Organizations

Running

Locally with Docker-Compose

For faster turn around when developing API, use: This starts up the app with a Mongo instance running in Docker.

npm i
npm run local

Populate the local database with production data by doing the following:

  1. Download a production mongodump archive (ask an existing contributor to provide you with the archive).
  2. Extract zeta folder to be at the root level of this repo.
  3. Run the following mongorestore command:
mongorestore --host localhost:27017 zeta -d test

NOTE: Before running this command, it is highly recommended to increase memory availability in Docker Desktop to at least 5 or 6 GB.

Otherwise, the restore process may crash due to Docker's OOMKiller.

Locally against MONGO_URL

Note: You must supply MONGO_URL={URL_OF_SANDBOX_DATABASE} to test in this manner.

npm i
npm start
In Production

Currently deployed on Koyeb using Dockerfiles. To run api/web in prod mode, use:

npm i
npm run prod

Note: npm i is required, because it uses vite build as a post-install step and serves frontend files from the node itself, instead of running two processes concurrently.

Technical Stack
  • Main language: JavaScript (ES13), TypeScript when needed
  • Monorepo, Node/Fastify Backend, React (vite-swc) Frontend.
  • Backend serves API and static files: (build of React Frontend, downloadables, etc)
  • Mongo
Folder Structure
  • scripts/ -- standalone scripts
  • data/ -- imported (partially processed / split) data, mostly used by backend
  • shared/ -- source code imported by both front- and backend
  • api/ -- backend
  • web/ -- frontend
  • package.json -- monorepo wrapper scripts

For more info, see READMEs in each root folder

hitfactor.info's People

Contributors

codehowlermonkey avatar schizo-monke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hitfactor.info's Issues

Fix Tooltips

Tooltip component from prime react library is unreliable and has weird targeting.

Replace it everywhere where we have tooltips with something else

ShooterCell: hover to show quick info

Could be a good way to quickly look up something about the shooter that isn't available in the ShooterTable or RunsTable.

Maybe we can even fit graph in there, and definitely some version of a card, to show other divisions.

Could be web only using existing endpoints api/shooters/A99999

Best Classifiers to Pick Suggestion for MDs

I think we can just use https://primereact.org/messages/ and show it on top of Classifiers table with info style and something like: "Looking for which Classifier to Run? Select Your Most Popular Division and Sort by "Div. Qual". Or by OA Div. Qual to accomodate most divisions. Note: classifier quality isn't reflective of USPSA's official HHFs accuracy, and is only considering the accuracy of scores distribution.

Shooters Table

top20 to infinity and beyond, use data from classifications at first and nothing else

clicking anything in that table goes to #3

Optimize In-Memory JSON Array/Objects Issues

Currently everything is stored and pre-hydrated on server start in-memory, often duplicating the same data multiple times for easier access (e.g. classifier runs by shooter or by division/classifier).

This causes 2 main problems:

  1. Server requires quite a lot of RAM to run
  2. It takes a noticeable time to hydrate the data, multiple minutes on M1 Pro Macbook, resulting in serious loss of productivity, when constantly changing the API and reloading the server.

We need to find a way to optimize both of these things, but the second one is more important, at least until we get to really high RAM usage, which will force us to change hosting (right now app idles at slightly above 4GB with legacy scores, and around 2 without).

Some ideas how to achieve this:

  1. Sequelize + sqlite in memory, with proper DB tables design and basically rewrite of the whole model layer. HUGE EFFORT, HIGH CHANCE OF REGRESSIONS, if you can do this -- you're basically a legit senior backend dev.
  2. RxDB, has in memory, is basically nosql, but has schemas, maybe can be hacked together moderately easy-ish. Higher Middle Dev Level
  3. Just make GB+ JSON files work, JSONStream, await-sync, etc. Anything that will simply save shit to disk and cache it there. Won't help with memory, probably will make it worse. But should make development faster.
  4. Any other ideas?

Add last import date to the UI

Probably can just use a simple fs.stat on one of the files updated by the import script.

Or even make import script write the date on start / completion.

Fix/improve LO/CO data

LO/CO is a synthetic division made out of a merge between LO and CO data.

It was hacked up as quick as possible, simply to make app not crash.
We need to review debug everything we can with LO/CO div and make sure it doesn't crash and also uses proper data.

Right now all HHFs for it are LO HHFs, and instead we should pick the highest from CO and LO. And maybe show both

Shooter(s): recommended class

should also include:

  1. Rec. Percent in classifier scores table
  2. Rec. GMs / Ms/ As in classifiers table
  3. "Rec HHF" and "CurHHF - RecHFF" columns in the classifiers table
  4. Rec. Percent & Rec. Class in Shooters Table
  5. Same as 3. for shooters info

Classification Page: Inconsistencies Tab

  1. Add hq/cur/rec letters to api/shooters/:division
  2. Filter out where letters don't match
  3. Probably do different modes: hq-vs-cur, hq-vs-rec, I think cur-vs-rec isn't needed as both are synthetic
  4. review that classification percentage differences that we need for all modes are already there
  5. api can return all needed data and not be aware of the mode
  6. frontend can group by GMs/Ms by using multisort
  7. additional mode/toggle can be all/demotions/bumps

OG idea from howler monkey discord server, if you're from there and have something to add -- please leave a comment.

Implement Overall Quality tab in /classifiers

Because certain classifiers meet the bar for high-quality in some divisions and not others (particularly with fixed time classifiers that are too easy in PCC but more well-calibrated for minor handgun divisions), we should implement an Overall Quality score in its own tab under the Classifiers section.

This could be as simple of taking the MIN of the quality score for the classifiers across the more significant divisions (LO, CO, PCC, OPN, LTD).

This Overall Quality tab could serve as a one-stop shop for match directors looking to pick high-quality classifiers without needing to verify quality against all relevant divisions.

Anti-Cheat/Auto-Report: Scores That Are Edited Long Time After Initial Entry

In Discord, the Monkeys have identified several serial cheaters, which often would edit their scores MUCH later than a reasonable match frame.

We already have reports and ability to mark scores as "bad", maybe we can look into edit history and auto-report scores for manual review, without the need to someone stumble upon them in the first place.

HF entries for classifiers above 120% could be marked as suspicious as well.
TODO: think about other automatic suspicious activity detection ideas and open issues for them

Consistent URLs for filters/sort/page/etc

Right now, things like filters, pagination, and sort aren't reflected in the URL.

It's not super hard to support this, but it requires significant effort for not-so-much of a reward (quick linking for sending your analysis data sources to someone else for discussion / review).

Parking this as a known issue / TODO / improvement

Clubs Table

Mostly this is useful for catching cheaters / reviewing clubs that have shooters with sus scores.

See #22

Fetch expired members

When classifier scores were fetched we filtered out the inactive (as of Jan 2024) members.
The fetch for classifications of members was done after that only against active members.

This resulted in some scores show up with X classification and "Expired / Not Found".

We need to refetch expired members and possibly support active/inactive expiration status in addition to what we have now.

Probably is blocked by #2

Persistent Sort/Page in Tables

Related to #9, but unlike queryString params, this is about storing the default sort for each table in localStorage, so when user navigates to url without sort params -- we apply their last choice automatically.

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.