Skip to content

paccloud/Fish_Cost_Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐟 Local Catch Fish Yield Calculator

A community-driven fish cost calculator for sustainable seafood. Calculate the true cost of fish products after accounting for processing yields, fees, and other factors.

License: MIT

🌊 Overview

Local Catch helps fishers, processors, and seafood businesses accurately calculate the cost per pound of finished fish products. Whether you're a small-scale fisher selling direct to consumers or a processor managing multiple species, this tool provides the yield data and calculations you need.

🎣 Born from the Local Catch Community

This project emerged from conversations within the Local Catch Networkβ€”a community of fishing families, organizers, researchers, and technical assistance providers working to support healthy fisheries and communities across North America.

What is Local Catch Network?

Local Catch Network connects Community Supported Fisheries (CSFs) and values-based seafood businesses with the resources they need to thrive. With over 200 member organizations, Local Catch is at the forefront of the direct-to-consumer seafood movement, helping fishers build sustainable livelihoods while providing consumers access to fresh, locally-caught seafood.

CSFs work like a seafood subscriptionβ€”consumers pay upfront for a "share" of the catch, creating stable income for fishers while cutting out middlemen. This model supports:

  • Fair prices for fishers - Direct sales mean better returns
  • Fresher seafood for consumers - Local catch, not global supply chains
  • Reduced carbon footprint - Less transportation, more sustainability
  • Stronger fishing communities - Economic stability and local connections

Why This Tool?

When Local Catch members discussed the challenges of pricing their products, a common pain point emerged: calculating the true cost of processed fish. If you buy whole fish at $3/lb but sell fillets, what should you charge? This tool answers that question with real yield data, helping small-scale fishers price their products accurately and sustainably.

Find a CSF near you: finder.localcatch.org

Key Features

  • 60+ Species Database - Comprehensive yield data from salmon to sharks, rockfish to shellfish
  • From β†’ To Conversions - Calculate yields between any processing states (Round, D/H-On, Fillets, etc.)
  • Cost Calculator - Factor in processing costs, cold storage, and shipping
  • Weight Calculator - Determine how much input weight you need for a target output
  • User Accounts - Save calculations and add your own custom yield data
  • Data Transparency - Full source attribution and methodology documentation

πŸ“Έ Screenshots

Calculator Data Sources
Select species, conversion type, and calculate costs View data sources and methodology

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/paccloud/Fish_Cost_Calculator.git
cd Fish_Cost_Calculator

# Install frontend dependencies
cd app
npm install

# Install backend dependencies
cd ../server
npm install

Running Locally

Terminal 1 - Backend Server:

cd server
node server.js
# Server runs on http://localhost:3000

Terminal 2 - Frontend:

cd app
npm run dev
# App runs on http://localhost:5173

πŸ—οΈ Project Structure

Fish_Cost_Calculator/
β”œβ”€β”€ app/                          # React frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Calculator.jsx    # Main yield/cost calculator
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx         # User authentication
β”‚   β”‚   β”‚   β”œβ”€β”€ UploadData.jsx    # Excel/CSV data import
β”‚   β”‚   β”‚   β”œβ”€β”€ DataManagement.jsx # CRUD for user data
β”‚   β”‚   β”‚   β”œβ”€β”€ DataTransparency.jsx # Data sources page
β”‚   β”‚   β”‚   └── About.jsx         # About page
β”‚   β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”‚   └── AuthContext.jsx   # Authentication state
β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”‚   └── fish_data_v3.js   # 60+ species yield database
β”‚   β”‚   β”œβ”€β”€ App.jsx               # Main app with routing
β”‚   β”‚   └── main.jsx              # Entry point
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/                       # Express backend
β”‚   β”œβ”€β”€ server.js                 # API endpoints
β”‚   β”œβ”€β”€ fish_app.db              # SQLite database
β”‚   └── package.json
β”‚
β”œβ”€β”€ data/                         # Legacy data files
β”œβ”€β”€ datasets/                     # Additional datasets
└── MAB-37PDF-*.pdf              # Source PDF document

πŸ”§ Technology Stack

Frontend

Technology Purpose
React 19 UI framework
Vite 7 Build tool & dev server
React Router 7 Client-side routing
Tailwind CSS 3 Styling
Lucide React Icons

Backend

Technology Purpose
Express 5 API server
SQLite 3 Database
JWT Authentication
bcrypt Password hashing
Multer File uploads
xlsx Excel parsing

πŸ“Š Database Schema

SQLite Tables

-- User accounts
users (
    id INTEGER PRIMARY KEY,
    username TEXT UNIQUE,
    password TEXT,          -- bcrypt hashed
    role TEXT DEFAULT 'user'
)

-- Saved calculations
calculations (
    id INTEGER PRIMARY KEY,
    user_id INTEGER,
    name TEXT,
    species TEXT,
    product TEXT,
    cost REAL,
    yield REAL,
    result REAL,
    date TEXT
)

-- User-submitted yield data
user_data (
    id INTEGER PRIMARY KEY,
    user_id INTEGER,
    species TEXT,
    product TEXT,
    yield REAL,
    source TEXT
)

🌐 API Endpoints

Authentication

Method Endpoint Description
POST /api/register Create new account
POST /api/login Login, returns JWT

Calculations (Auth Required)

Method Endpoint Description
POST /api/save-calc Save a calculation
GET /api/saved-calcs Get user's saved calculations

User Data (Auth Required)

Method Endpoint Description
GET /api/user-data Get user's custom yield data
POST /api/user-data Add new yield entry
PUT /api/user-data/:id Update yield entry
DELETE /api/user-data/:id Delete yield entry
POST /api/upload-data Upload Excel/CSV file

πŸ“– Data Sources

The primary yield data comes from:

"Recoveries and Yields from Pacific Fish and Shellfish"
Marine Advisory Bulletin No. 37
Authors: Chuck Crapo, Brian Paust, Jerry Babbitt
Publisher: Alaska Sea Grant College Program, 2004
ISBN: 1-56612-012-8

Species Coverage

Category Species Count Examples
Salmon 5 Pink, Chum, Sockeye, Coho, Chinook
Rockfish 17 Black, Canary, Yelloweye, Quillback
Flatfish 13 Halibut, Dover, Petrale, Rex Sole
Sharks 7 Salmon, Blue, Thresher, Dogfish
Crab 4 Dungeness, King, Tanner
Shellfish 12+ Clams, Oysters, Scallops, Mussels
Other 15+ Sablefish, Lingcod, Tuna, Squid

Acronyms

Acronym Meaning
D/H-On Dressed/Head-On (gutted, head attached)
D/H-Off Dressed/Head-Off (gutted, head removed)
S/B Skinless/Boneless
Round Whole fish as caught
Fletch Large fillet from halibut/flatfish

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Report bugs - Open an issue describing the problem
  2. Suggest features - Open an issue with your idea
  3. Add yield data - Contribute verified yield data for species not yet covered
  4. Improve documentation - Help make the docs clearer

Development Workflow

# Fork the repo
# Create a feature branch
git checkout -b feature/my-feature

# Make your changes
# Test locally

# Commit with descriptive message
git commit -m "Add: [description of change]"

# Push and create PR
git push origin feature/my-feature

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Local Catch Network - This project was born from community discussions about the real challenges fishers face when pricing their products. Thank you to all the Local Catch members who shared their experiences and needs.
  • Alaska Sea Grant College Program - For the comprehensive yield data in MAB-37
  • The fishing community members who have contributed feedback and data

β˜• Support

If you find this tool useful, consider supporting continued development:

Buy Me a Coffee


Built with ❀️ for the fishing community

About

A way to figure out the cost of fish for direct Marketers

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •