Giter VIP home page Giter VIP logo

ynab-absa-csv-convert-js's Introduction

YNAB ABSA Bank CSV converter

A JavaScript CSV converter to make Absa Bank (South Africa) statements compatible with You Need A Budget (YNAB).

The main issue with YNAB is that it truncates description fields that are over a certain length. Absa statement descriptions add information at the start which causes the payee info to be cut off. For example:

POS PURCHASE (EFFEC 17082020) PNP CRP WATERFRONT WATER CARD NO. 0123

Would be imported as:

POS PURCHASE (EFFEC 17082020)

Which removes all useful information. This converter will split that and add the following to the memo and description columns:

  • Memo - POS PURCHASE (EFFEC 17082020)
  • Description - PNP CRP WATERFRONT WATER CARD NO. 0123

The converter also does the following:

  • Adds a "Memo" column to all records
  • Changes the date format to YYYY-MM-DD
  • Converts the CSV format into a more standardised format with quotes around all description and memo fields

Usage

You can either visit https://kdevnel.github.io/ynab-absa-csv-convert-js/ and use the converter from there or download the latest version inside the /docs folder - download the folder and open index.html in your browser.

Setting up a dev environment

  • Download the codebase to your computer
  • Navigate to the project folder root and run npm install
  • Start the dev server by running npm start
  • The app should load in your browser and use live reloading and inline source-mapping
  • Use the /testing/input-sample.csv file in the file uploader
  • You should see a dynamically generated table containing the formatted CSV data on the page
  • You should see a download button to download a formatted CSV file to your computer

Bundling updated files to /docs

To create a production-ready set of bundled files in /docs run npm run build after following the steps to setup a dev environment. This will minify the files and use source-maps.

ynab-absa-csv-convert-js's People

Contributors

bgrgicak avatar kdevnel avatar maksymalist avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ynab-absa-csv-convert-js's Issues

Move to using modules

In order to prepare for integrating webpack and to manage the size of the codebase as it grows let's move to using JS modules to split up the code.

Change table generator to use a configuration array and document.createElement

This table generator works, but it's not the standard JS way of doing things.
Ideally, you would use document.createElement to generate HTML, this isn't a must-have, but it's a good practice.

What if you would use a configuration array to define what goes into the table and how it's structured. In that case, your outputHTML function would use that configuration to generate both the header and content parts.
An example configuration could be (see The pragmatic programmer
Metaprogramming
):

[
  {
    header: 'Date',
    key: 'Date',
  },
  {
    header: 'Memo',
    key: 'Memo',
  },
]

Originally posted by @bgrgicak in #8 (comment)

Project review June 7th

Issues

  • npm init should be replaced with npm install
  • Currently, I can upload an invalid file (output-sample.csv), and the page accepts it. Ideally, the app should warn that the file is invalid and refuse to render it.
  • Each submit adds an additional download link. There should be just one link (see screenshot 1)
  • CSS uses HTML tags for styling, this is a bad practice. CSS classes should be used instead.
  • The memo specific logic should be in one place only to improve readability and make the code simpler. I suggest adding memo to the switch.
  • Using names like array and string doesn't describe the variable content. The variable content should be clear from reading the name. This can produce long variable names, but that's ok.
  • Rename test to something descriptive
  • Use JS and a configuration file to render the output table instead of HTML strings. (Tip: this configuration file can also be used for data validation)

Improvements

  • Add export unit tests (just for fun ๐Ÿ˜„)
  • Move consts in app.js to the callback.
  • Add CSS prefixing to Webpack. This will automatically add prefixes like -webkit-appearance to CSS and ensure browser support.
  • It's a good practice not to use anonymous functions, but to move callbacks to proper functions. This would also avoid nested anonymous callbacks like in this callback.
  • It would be nice to reuse the import file name for the export filename and just add an extension at the end (e.g. input-sample-export.csv).

Questions

  • Why is the CSS bundled inside JS?
  • Would it make sense to move the submit callback to a separate file?

Screenshots

Screenshot 1

Screenshot 2021-06-07 at 08 45 01

Test links at the bottom of the chart

Each time I click submit, I get two links with the word test at the bottom of the table.

Ideally, there should be only one link, and it should have a descriptive name.

Screenshot 2021-06-21 at 10 08 57

Validate input file before processing

From #20

Currently, I can upload an invalid file (output-sample.csv), and the page accepts it. Ideally, the app should warn that the file is invalid and refuse to render it.

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.