Skip to content

This is a little program I wrote to help me decide if a manual task is worth automating. It's a NextJS app, written using v0.dev by Vercel, then ported to CloudFlare Workers using OpenNext. A fun little project.

License

Notifications You must be signed in to change notification settings

ashakoen/ought-o-mate-ak

Repository files navigation

Advanced Task Optimization Calculator

Overview

This app helps you assess whether automating a recurring task is beneficial based on multiple factors. It provides a holistic view by considering not just time savings but also the inconvenience, error potential, opportunity cost, and maintainability of manual tasks.

Key Features:

  • Time Impact: Calculates how much time you spend on the task over 5 years.
  • Inconvenience Factor: Evaluates how disruptive the task is to your workflow.
  • Opportunity Cost: Measures the potential value of time spent elsewhere.
  • Error Potential: Assesses the likelihood of making mistakes.
  • Maintainability: Considers how difficult it would be to maintain the automated solution.
  • Automation ROI: Provides a clear recommendation based on the return on investment for automating the task.

Workflow & Hosting

This app was developed using @vercel’s v0.dev AI assistant to write the code. However, instead of hosting it directly with Vercel, I ported the app over to OpenNext and deployed it to Cloudflare Workers using the Cloudflare adapter and Wrangler CLI for deployment.

My Workflow:

v0.dev -> OpenNext -> Cloudflare Workers

This approach avoids vendor lock-in while maintaining flexibility and ease of use.

Steps for Getting the App from v0.dev to OpenNext and Cloudflare

1. Setting Up the OpenNext/Cloudflare Project

Start by installing the necessary dependencies for Open-Next and Cloudflare integration:

npm install --save-dev @opennextjs/cloudflare
npm install -D wrangler@latest
npm create cloudflare@latest -- task-optimizer-next-cf --framework=next --experimental

Once the project is scaffolded:

cd task-optimizer-next-cf

2. Setting Up shadcn-ui Components

The UI components in the app are built using shadcn-ui, which is what v0.dev uses when creating UIs. Install an older version of shadcn-ui to avoid bugs:

npx shadcn-ui@0.8.0 init
npx shadcn-ui@0.8.0 add button card input label select slider

3. Installing Additional Libraries

Install the additional libraries used in the app, such as framer-motion, recharts, and lucide-react:

npm install framer-motion recharts lucide-react

4. Creating Component and App Files

Since OpenNext Cloudflare doesn’t scaffold the necessary code folders, you need to manually create them and copy the code from v0.dev:

mkdir components
nano components/AdvancedTaskOptimizer.tsx # Copy the component code here

mkdir app
nano app/page.tsx # Copy the v0.dev code for page.tsx
nano app/layout.tsx
nano app/globals.css

5. Running the App

Start the development server to ensure everything works:

npm run dev

Note: You may need to install pnpm globally for the Cloudflare adapter to work:

npm install -g pnpm

6. Preview and Deployment on Cloudflare

You can preview the app locally using the Cloudflare Workers CLI:

npm run preview

Once you're satisfied with the preview, deploy the app to Cloudflare:

npm run deploy

How It Works

Algorithm:

The app calculates a "total impact" score to quantify the benefits of automation using the following formula:

Total Impact = Time Impact (5 years) + Inconvenience Impact + Opportunity Cost Impact + Error Potential Impact + Maintainability Impact
  • Time Impact: Time spent on the task over 5 years.
  • Inconvenience Impact: How disruptive the task is (based on your rating).
  • Opportunity Cost Impact: Time you could spend on other activities.
  • Error Potential Impact: Likelihood of errors.
  • Maintainability Impact: Difficulty of maintaining the automated solution.

Formula Details:

Factor Weight Formula
Inconvenience 0.2 Inconvenience Factor * 0.2 * Time Impact (5 years)
Opportunity Cost 0.2 Opportunity Cost * 0.2 * Time Impact (5 years)
Error Potential 0.1 Error Potential * 0.1 * Time Impact (5 years)
Maintainability 0.1 (10 - Maintainability) * 0.1 * Time Impact (5 years)

Automation ROI:

Automation ROI = Total Impact / (Time to Automate in Hours * 60)

The app uses this ROI to recommend whether automation is Strongly Recommended, Recommended, or Not Recommended.

Example Use Case

Let’s say you spend 10 minutes on a task daily, it’s very inconvenient (Inconvenience Factor = 7), and you estimate 30 hours to automate the task. The app will calculate:

  1. Time Impact (5 years):
    10 minutes * 365 days * 5 years = 18,250 minutes

  2. Inconvenience Impact:
    7 * 0.2 * 18,250 = 25,550 minutes

  3. Opportunity Cost Impact:
    ...

The app then sums up the impacts to compute Total Impact and provides an automation recommendation based on the Automation ROI.

Saving Results

  • Save Results: You can save your most recent calculations to your browser’s local storage.
  • Automatic Load: When you revisit the app, your last saved results are automatically loaded.
  • No History: Only the most recent result is saved.

About

This is a little program I wrote to help me decide if a manual task is worth automating. It's a NextJS app, written using v0.dev by Vercel, then ported to CloudFlare Workers using OpenNext. A fun little project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published