Giter VIP home page Giter VIP logo

benford-test's Introduction

benford-test

Web application built with Flask/Vue.js for testing conformity of .csv data to Benford's Law.

This app allows users to upload a CSV file with numerical data and test it for conformity to Benford's Law, a statistical phenomenon that can be used in forensic accounting to detect fraud. The law states that in a large set of numbers, leading digits occur with a frequency that is logarithmic to their rank. For example, the number 1 should occur about 30% of the time, while the number 9 should occur about 4.5% of the time.

The specifications to which I built this app can be found in /specifications.md. Included tests make use of data in /Benford 1938.pdf

Demo

A live demo running on AWS Elastic Beanstalk is available here.

Features

  • Simple Vue UI with single-page architecture
    • Bootstrap-based responsive layout
    • Separation between backend and frontend via RESTful API
    • Validation with user feedback on errors, e.g., improperly formatted or non-numeric .csv files
  • Multiple file upload
    • SQLite database persists uploaded files
  • Preview of uploaded .csv files:
    • Displays filename with row/column count
    • Table of first six rows (five plus header) of file
    • Enumerates columns with numerical data viable for analysis
  • Analysis of CSV data:
    • Histogram and frequency table shows expected/observed distributions
    • Test of conformity to Benford's law (Pearson's chi-square goodness-of-fit test)
      • Dropdown menu for p-values from 0.001 to 0.01
      • Test statistic, critical value, and test result for chosen p-value
      • Description of null hypothesis and interpretation of result
  • Exception handling:
    • Improperly formatted .csv files or files without numerical data
    • Selected columns which are more than 10% non-numeric

Docker

I have uploaded a container to Docker Hub:

docker pull nelsonlove/benford

Tests/Workflows

A number of tests are included in this repo, including tests making use of Benford's original data to ensure that the numerical analysis is accurate. These tests are split into two subdirectories, tests/backend and tests/cypress. I have written four GitHub Actions workflows for this project, found in the ./github/workflows subdirectory:

  • backend-tests.yml: backend tests handled by python -m unittest discover
  • cypress-tests.yml: starts a Flask instance in the background before running Cypress.
  • docker-hub-push.yml: pushes container image to Docker Hub.
  • elastic-beanstalk-deploy.yml: deploys image to AWS.

benford-test's People

Contributors

nelsonlove avatar

Watchers

 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.