Git Product home page Git Product logo

bubble_scan's Introduction

Bubblescan

Project Overview

The chemistry department at SLU uses paper scantron (fill-in-the-bubble) sheets for exams. To grade exams, they physically take the papers to one of the two machines on campus capable of processing the data. This process is time-consuming and a bit risky - the machines are getting old and might break. In general, they like using paper-based fill-in-the-bubble exams but are interested in digitizing the grading process through software that presents them with detailed results, similar to the results they get from the physical scantron machines. The specific sheets used by the chemistry department are Scantron form number 95945. While not hugely expensive, not having to order such sheets is a cost-saving. Most importantly, this software would replace the technology that's becoming obsolete and simplify the grading process.

This project automates the scanning of Scantron documents and the extraction of data to CSV files using a web-based application. Users can upload scanned images of their Scantron forms, which are then processed by our backend AI algorithms to generate and retrieve CSV files containing the extracted data. This system is designed for educational institutions and testing centers to streamline their grading processes and data management.

Software Architecture

Optional Alt Text

Prerequisites

Before you begin, ensure you have the following software installed on your system:

  • Node.js (including npm)
  • Python 3.6 or newer
  • Git

Environment Setup

If you want to run the app locally, you will need two terminals to get Bubble scan set up. One for the React component, and other for the Flask component.

React Application Setup

This project was bootstrapped with Vite. It is a simple setup to get started with React and Vite.

First, clone the repository and navigate into the project directory:

git clone <your-repository-url>
cd <your-project-name>

npm install
npm install cors
npm run build
npm run dev

Your React application will be accessible at http://localhost:5173/.

Flask Application Setup

Prerequisites

This guide provides step-by-step instructions for setting up a Flask application within a virtual environment. This ensures that your project dependencies are managed efficiently without affecting other Python projects.

Before you start, make sure you have Python installed on your system. Flask supports Python 3.6 and newer.

Step 1: Go into ServerCode folder

cd ServerCode/application

Step 2: Create the Virtual Environment

  • On macOS and Linux:

    python3 -m venv venv
  • On Windows:

    python -m venv venv

Step 3: Activate the Virtual Environment

Before you can start using the virtual environment, you need to activate it. The command varies depending on your operating system.

  • On Windows:

    .\env\Scripts\activate
  • On macOS and Linux:

    source venv/bin/activate

You'll know the virtual environment is activated because its name will appear at the beginning of the terminal prompt.

Step 4: Install Flask or dependencies

With the virtual environment activated, install all the requirements using pip:

pip3 install -r requirements.txt

Step 5: Run Your Flask Application

You must run the App server i.e AppServer.py to run the app

You can run your Flask applications using the AppServer.py file as your entry point:

python3 AppServer.py

Your App server Flask application will be accessible at http://127.0.0.1:5001/.

Step 6: Deactivate the Virtual Environment

When you're done working on your project, you can deactivate the virtual environments by running:

deactivate

This command will return you to your system's default Python interpreter.

Usage

Uploading a scantron document:

  1. Navigate to http://localhost:5173/
  2. Follow the prompts to upload a scanned image of the Scantron document.

Initiating the Scanning process

Once the document is uploaded, the processing starts automatically.

Retrieving the generated CSV file

Upon completion, a link to download the CSV file will be available directly on the web interface.

Docker Set Up

Make sure your docker file exists in the root directory and your docker is active. The docker file helps running the app in a single server. Follow the commands below:

cd bubble_scan

// Build the docker image
docker build -t bscan .

// Run the docker container
docker run -p 5001:5001 -p 5173:5173 bscan

Your bubble scan application will be accessible at http://127.0.0.1:5001/.

bubble_scan's People

Contributors

rkarmuri avatar mylescorrea avatar kate-holdener avatar nneni avatar ruthvikm avatar

Watchers

Daniel Shown avatar

Forkers

rkarmuri

bubble_scan's Issues

Get feedback from the client and discuss about custom formatted answer sheet

Now the web application is functional as expected, schedule an appointment with the client and get the feedback. Make any improvements based on the feedback. Also, discuss custom formatted answer sheets for the future.

Success criteria:

  • Could you explain the project structure to the client and get their insight?
  • A demo of the web application functionality is displayed to the client.
  • Discussed the use of the custom formatted answer sheets.
  • Report the discussion points in a markdown file.

Fix the issues with running Flask and React Components using Docker

We could create the docker image, but some issues are running the Flask and React components using the docker. The docker image couldn't install the Python library PyMuPDF using the docker build. Try to come up with a new library that serves the purpose of extracting images from the PDF like the pdf2image or PyPDF2 to work with the docker build. Also, the react component although it builds the image and opens port 5173, doesn't create the frontend webpage. Try to resolve these issues and make the application run using docker images.

Success criteria:

  • The docker image successfully created the Flask component.
  • The docker image successfully created the React Vite component.
  • The React component shows the webpage to upload the image and download the CSV after PDF processing.
  • There were no issues encountered when connecting the Flask and React components.

Meet with the AI capstone team

The AI team is actively working on scanning bubbled scantron sheets and extracting the student IDs along with their answers for each sheet. To ensure seamless integration between the AI and server components, it is essential to understand the data generated by the AI component and adapt the server component accordingly. Explore various formats such as JSON, CSV, or any other structured data format that aligns with both teams' requirements. Ensure that the server component can seamlessly process the data sent by the AI component.

Success criteria:

  • A meeting with the AI capstone team is scheduled and conducted to discuss the data generated from the scantron sheets.
  • Document the agreed-upon format and share it with both teams for reference.
  • Update the server component to handle the agreed-upon data format efficiently.
  • Discuss any potential challenges or limitations regarding the data format and integration.

Client component of the project

This issue is part of issue #1

The client component will provide the user with a web browser based user interface for input and output, and will interact with the server component (as defined in issue #2) to submit user inputs and to receive outputs. The client component needs to be in a separate directory from the server. There are several frameworks for building client-side components, React might be a good option (other options may be just as good).

Success criteria for this issue:

  • High level component, client, exists in the project as a separate directory
  • The client component provides a browser based user interface - allowing the user to enter input (any dummy input is fine for nwo)
  • There are clear instructions in the form of a README.md file specifying how to start the client
  • The client provides a way to submit user input to the server, as defined in issue #2
  • A .gitignore file, appropriate for the client side tech, is included in the client directory

Replace the Mock AI with the real AI

Now that the mock AI is ready, it can generate the dummy data. We can replace the mock AI with the real AI. Connect with the AI team and replace the mock AI component. Discuss how the AI runs and allow it to send the JSON data to our application server. The application server then converts the JSON to a CSV file. Also, we should make the React component run animation until the Flask component returns a CSV file.

Success criteria:

  • The AI component successfully connects with the application server without any CORS issues.
  • The AI component successfully sends the JSON data to the application server without issues.
  • The application server successfully converts the JSON to a CSV file.
  • The application server successfully sends the CSV file to the React component.
  • The React component successfully allows downloading the CSV file.
  • The ReadMe file on the main branch is updated to run the project including the requirements.txt file to install the Python libraries.

Customize the backend component

We need to build a robust backend component. We have all the code in pieces, and we need to combine each functionality. The Flask component should receive the Scantron sheets' PDF that will be split into individual pages and sent to the mock AI component. The mock AI component processes the PDFs and sends a JSON format. The Flask component should receive the JSON format and convert it to CSV. The CSV file is sent to the React component.

Success criteria:

  • Implemented functionality in the Flask component to split the received PDF into individual pages.
  • The Flask component successfully sends the split pages to the mock AI component.
  • The Flask component successfully receives the JSON format from the mock AI component.
  • The Flask component successfully transforms the JSON data into CSV format.
  • The Flask component effectively sends the generated CSV file to the React component.

Create a development branch and add unit tests to backend and frontend components

We will establish a dedicated development branch alongside our existing branches to ensure comprehensive testing and seamless development. This allows us to conduct thorough testing before integrating changes into other branches.
For testing purposes, we will write unit tests for every method within the Flask framework and all components within the React framework. These unit tests serve as a safety net, enabling us to detect and address any issues promptly during development.

Success criteria:

  • Well-defined unit tests are meticulously crafted for every method within the Flask framework.
  • Detailed unit tests are meticulously written for each component within the React framework.
  • All unit tests execute successfully, validating the integrity and functionality of our software components without encountering any issues.

Address the linting errors on the main branch

We have identified several linting errors in the main branch of our repository, visible in the Action tab on GitHub. These errors, encompassing syntax issues, whitespace discrepancies, import errors, missing function routines, and undefined variables, need immediate attention to ensure the optimal functioning of all components.

Instructions:

  • Focus solely on the main branch for this linting cleanup.
  • Please pay close attention to each category of linting error mentioned above.
  • Document any challenges faced during the process.
  • If uncertain about any specific linting standard, refer to the linting tool's documentation at https://pylint.pycqa.org/.

Success criteria:

  • The linting tool should successfully parse the code in the files and no 'invalid syntax' errors should be reported.
  • The linting tool should handle whitespace errors in the files.
  • Docstrings should be added or corrected according to the linting standards.
  • After making changes, rerun the linting tool to confirm that all issues have been successfully addressed.

Enhance React Component to Handle CSV Data and Enable Download Functionality

In alignment with the recent decision, the AI team will provide data in JSON format, and the Flask component will be responsible for converting this JSON format into a CSV file, as specified by the client (shared in the inputData folder). To adapt to this change, the React component needs to be enhanced to seamlessly handle CSV files received from the Flask backend and facilitate users in downloading these files using a dedicated "Download CSV File" button. Ensure the React component verifies the integrity of the downloaded files to prevent corruption issues.

Success criteria:

  • The React component successfully handles the CSV data received from the Flask backend.
  • The React component implements the download of the converted CSV file using the download CSV file button.
  • Users can successfully download the converted CSV file through the React component.
  • The React component performs checks to ensure the downloaded files are not corrupted.

Customize Frontend for Scantrons PDF Upload and Instructions

We need to customize the frontend component to enhance the user experience and functionality of the webpage. This enhancement aims to facilitate the upload of a PDF document containing Scantron sheets and provide instructions on how the software works.

Success criteria:

  • Removed the input fields for first and last names from the current webpage to streamline the user interface.
  • Removed the input to send a message to the Flask on the current webpage as it is unnecessary for this functionality.
  • Implemented functionality on the frontend webpage to allow users to upload the Scantron sheets' PDF document.
  • Ensured that the webpage provided visual acknowledgment to users once the PDF document was successfully submitted.
  • The React component successfully allows users to download the CSV file sent by the backend component.

Accept JSON Format File from AI Component

As discussed with the AI team, we will be receiving a JSON format file from the AI component. Therefore, make the Flask component accept the JSON format on the backend. The template of JSON format and the client-shared CSV files will be uploaded to the main branch in the inputData folder. For now, accept the JSON format in the form of an input file on the Flask server.

Success criteria:

  • The Flask component accepts JSON format as an input file.
  • Implement the logic on the Flask component to convert the JSON to CSV format shared by the client.
  • The Flask component sends the CSV format to the React component.

Generate the JSON using a mock AI component

We need to develop a mock AI component to emulate the functionality of the real AI component for processing Scantron sheets' PDF documents. The mock AI should receive the split PDF documents and return the output in JSON format to the Flask app component. For each sheet, we need to generate a student ID and their answers in JSON format. As discussed with the AI capstone team, we will use the current output JSON format as a reference to the output of the mock AI component. When the real AI module becomes available, we'll replace the mock AI component with the real AI module.

Success criteria:

  • The mock AI component receives the split Scantron sheets' PDFs as input.
  • The mock AI component successfully generates student IDs and answers for each page.
  • The mock AI component stores all the data in JSON without encountering any issues.
  • The mock AI component successfully sends the JSON to the Flask app component.

Upload images on the client component

We are combining all students' scantron sheets into a PDF file. Therefore the user can upload the inputData/exampleScans.pdf file through the user interface. We are to restrict uploading any other file formats on the user interface.

Success criteria for this issue:

  • The react component allows users to upload files to the server component.
  • No CORS issues should occur during the file upload process.
  • The server component acknowledges that the files are uploaded successfully.
  • The UI doesn't allow users to upload other file formats.

Let user upload a pdf file and receive data from this file

Description
One of the fundamental functionalities of this application is allowing user to upload a digital copy of the scantron sheet and to get the data contained in that sheet: student's id and student's answers for each question. This means that the necessary pieces need to be added to the client and server side applications, and these pieces need to be integrated together. While we currently don't have the necessary AI component for extracting the data from the scantron sheet, we can build the software infrastructure capable of passing the file from the client to the server, and calling the AI module (the mock AI module for now).

Describe the solution you'd like
At this stage, I'd like a simple solution as follows:

  1. The user can upload a the inputData/exampleScans.pdf file through the user interface.
  2. The user gets a response with the following data per exam: student id, question 1 answer, question 2 answer, ..., question 50 answer
  3. The data is displayed in simple format in the user interface (nothing fancy, the simplest way is best at this point)

Additional Context
This is a container issue, which is further broken into smaller issues listed below:

Create project structure

The first step to this project is to define the structure - how the code will be broken up in various modules (defined by directories) and define how the directories will interact with each other.

Since this project will use an AI module, developed by another team, using Python for interacting with the AI module seems like a reasonable approach. There should also be a web API for accessing the features built as part of this project.

I suggest to follow the "Clean Architectures in Python" approach for defining the API and functionality provided through this API: https://leanpub.com/clean-architectures-in-python

For user interactions, any front-end framework would work (I do not recommend using Python for the front-end). React, for example, is a reasonable choice.

This issue is broken up into smaller issues

Project summary in README

In the README file, please provide a brief overview of the project. The overview should explain what we are doing in this project from a user perspective. Detail the steps required to run the code effectively. This should include instructions on setting up the development environment, installing dependencies, and starting the frontend and backend servers. Have an architectural diagram of the program on how it is set up. Additionally, guides on uploading a scantron document, initiating the scanning process, and retrieving the generated CSV file. Finally, remove unnecessary files and folders within the project.

Success criteria:

  • Detailed steps for setting up the development environment, including any prerequisite software or tools are provided.
  • Removed unnecessary files and folders and structured the project neatly.
  • Clear guidance on installing front and backend component dependencies.
  • Instructions for starting the frontend and backend servers, including any configuration settings or environment variables are provided.
  • A step-by-step process for uploading a scantron document, initiating the scanning process, and retrieving the generated CSV file is provided.
  • An architectural diagram is provided to show the software design.

Create Dockerfile for Project Setup

The primary goal of this issue is to create a Dockerfile that enables users to easily build and deploy the project as a Docker container. The Dockerfile should include instructions for setting up the development environment, installing dependencies, and running both the frontend and backend components within the container. Write a Dockerfile that includes instructions for building the Docker image. Use a suitable base image (e.g., Node.js for frontend, Python for Flask backend). Install necessary dependencies for both frontend and backend components. Configure the Dockerfile to expose the required ports for accessing the application. Provide clear guidance on Docker commands and best practices for developers and users.

Success criteria:

  • A well-defined Dockerfile that facilitates the containerization of the project exists.
  • All necessary dependencies for both frontend and backend components are installed.
  • The Docker image can successfully run the project locally and across different environments.
  • Docker commands and best practices for developers and users are specified.

Process the uploaded PDF files

When receiving a PDF document from the client component, the Flask server needs to efficiently process the document and separate it into pages. Each page contains essential information such as the student ID and their answers. This feature aims to facilitate the server-side handling of PDF documents received from the client component

Success criteria:

  • Ensure the server component correctly receives the PDF document from the client component.
  • Implement functionality for the server component to process the received PDF document.
  • Separate the processed PDF document into individual pages, with each page containing the student ID and their corresponding answers.
  • Enable the ability to download the separated pages for testing purposes, demonstrating accurate representation of the processed PDF content.

Meet with the client and discuss the output format

Now that we can communicate between the client and the server, we should meet with the client and discuss how they want the output to be displayed on the client side. We need to schedule a meeting with the client. Based on the client's feedback display a draft output on the client component.

Success criteria:

  • Could you explain the project structure to the client and get their insight?
  • Get feedback from the customer, and understand how they want to display the output.
  • Based on the client's feedback display a draft output on the client component.

Server component of the project

This issue is part of issue #1

The server component will provide web API access to the scoring/grading features defined by this project. This component will interact with the AI module, that will "read" the input images/files and give back the tabulated results. Before defining the details of the implementation, we need to set up the server component and its structure. Creating the server side in Python will simplify interactions with the AI module (which will most likely be in Python). Follow the "Clean Architectures in Python" as a guide for setting up the server side: https://leanpub.com/clean-architectures-in-python

Success Criteria for resolving this issue:

  • High level component, server, exists in the project repository
  • The server component provides access to a web API
  • There are clear instructions in the form of a README.md file specifying how to start the server
  • The server is broken up into smaller sub-components, following the "Clean Architectures in Python" approach (application, domains, serializers, use_cases).
  • The server works with the client component, as defined in issue #3
  • A .gitignore file, appropriate for the server-side tech, is included in the server directory

Mock AI component

This issue is part of issue #1

The machine vision (AI) part of this project will be developed by another team, in parallel. To better understand how our application will interact with the AI module and allow parallel development, we can build a mock AI module that the server component, as defined in issue #2, will interact with for now. When the real AI module becomes available, we'll replace the mock AI component with the real AI module.

Success Criteria for resolving this issue

  • High level component, ai_grader, exists in the project repository (the name ai_grader can be changed to something else, but something descriptive of the component's purpose)
  • The component defines an interface for sending input file (pdf or image format)
  • The component provides a mock student id and mock answers for each input file as a response (in the form of a list of answers for each question. For example: a, c, -, b, d, ...).
  • The mock response is defined in a file (simple text file would work).
  • The component works with the server component, as defined in issue #2, to provide mock responses for grading requests.

Upload image from my phone

Is your feature request related to a problem? Please describe.
I want to be able to quickly process a single sheet without scanning into a PDF.

Describe the solution you'd like
I'd like to be able to take a picture with my phone and submit it for a quick processing.

Describe alternatives you've considered
not sure of others.

Additional context
N/A

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.