Coder Social home page Coder Social logo

dedup_csv's Introduction

DedupCsv

Coding exercise to remove duplicate entries from a CSV input, either on Email or Phone

Executing the Code

The program takes one strategy flag and reads CSV input from STDIO. You can run it like this:

cat example.csv | mix run -e 'DedupCsv.main(["email"])'

Alternatively, I've compiled it using mix escript.build. Assuming you have erlang installed, so you can run the binary version, like this:

cat example.csv | ./dedup_csv email

Notes

I have been dabbling with Elixir over the past year. Even though it's not a language that I've had any professional experience using, I enjoy working in the language and chose it for this challenge. I'm sure that there are idioms that I'm abusing and I look forward to learning how to write "proper" Elixir code.

I chose to use an off the shelf CSV library instead of writing my own parser. Why reinvent the wheel? Origianly, I thought I'd use Enum.uniq_by (again, why reinvent) but found that the email_or_phone didn't play well with this, nor did it play well when a field was blank. When a field is blank, I chose to not dedup. However, if the file is missing headers, I chose to ignore the file, returning an empty output.

dedup_csv's People

Watchers

David Spigarelli 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.