Giter VIP home page Giter VIP logo

json-seeding's Introduction

Requirements

Write a process that imports the contents of a JSON-file cleanly and consistently to a database.

Running the script:

  1. npm install
  2. docker run --name="seeding-from-json" -d -p 5432:5432 -e POSTGRES_PASSWORD=secret postgres
  3. node index.js

Decisions taken:

  1. I used vanilla JavaScript because of familiarity and prior experience with it.

  2. For the primary task regarding SIGTERM or power failures, my solution checks if the record already exists in the DB based on account number and only then creates an entry in the database. Therefore, duplicates are avoided.

  3. Design for the future: I believe it can easily be improved with Sequelize-CLI which can be used to make migrations and use seeders so that columns can be added without destroying or resetting tables

  4. For the sensible data models: I have two models, one for the clients and one for the credit cards.

  5. For the age restrictions, I used Moment.js to find the differences

  6. If the source file grows, it would become very resource intensive and unsustainable. It was already quite resource-intensive. I need to do more research on how to more efficiently import JSON data and store it.

  7. I would say that the solution is fairly adjustable to other source data formats such as CSV or XML as I would still be checking for many of the same conditions.

  8. For the three identical digits sequence: I would use a combination of If statements and regex.

Limitations:

  1. Did not encrypt sensitive data such as credit card information and personal details.

  2. Solution is resource-intensive

  3. Solution does not use seeder or migration files

Thank you for taking the time to evaluate this assessment. I would appreciate feedback on how to improve.

json-seeding's People

Contributors

sneelagiri avatar

Watchers

James Cloos avatar  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.