{"id":21415690,"url":"https://github.com/npvisual/coding-ex","last_synced_at":"2025-06-19T05:40:33.295Z","repository":{"id":70645290,"uuid":"413942220","full_name":"npvisual/coding-ex","owner":"npvisual","description":"Coding exercise and discussions","archived":false,"fork":false,"pushed_at":"2025-02-19T16:32:31.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-03-16T18:56:42.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/npvisual.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-05T18:51:46.000Z","updated_at":"2025-02-19T16:32:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"384155ec-af09-4c85-9163-b9949ca6ec07","html_url":"https://github.com/npvisual/coding-ex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/npvisual/coding-ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npvisual%2Fcoding-ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npvisual%2Fcoding-ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npvisual%2Fcoding-ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npvisual%2Fcoding-ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/npvisual","download_url":"https://codeload.github.com/npvisual/coding-ex/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/npvisual%2Fcoding-ex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260696340,"owners_count":23048191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T18:51:48.019Z","updated_at":"2025-06-19T05:40:28.280Z","avatar_url":"https://github.com/npvisual.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## Introduction\n\nWhile you could accomplish some of these tasks using libraries like Pandas or Requests, one of the objectives of this exercise is to evaluate your ability to implement with Python’s standard library. Therefore, it is preferred that you use the “batteries that are included” with Python.\n\n\n\u003e __HINT :__ You should create new feature branch and clone this repo locally. You will then use your feature branch to submit a PR (pull request) against `dev` at the end of the exercise to present your masterpiece !\n\n\n### 1. Read CSV files via HTTP and write as JSON\n\nThere are two files to be downloaded and transformed:\n\n - https://pbryan.github.io/exercise/companies.csv\n - https://pbryan.github.io/exercise/opportunities.csv\n\nThe `companies` schema:\n```\nid: universally unique identifier\nname: string\nstart_date: date\nlogo_image_url: string\nemployees: integer\ntarget_account: enumeration: Yes, No\n```\n\nThe `opportunities` schema:\n```\nid: universally unique identifier\ncompany_id: reference to companies record\namount: integer\ntype: enumeration: new_logo, expansion, other\nupdated_at: timestamp in ISO 8601 format\nstatus: enumeration: pending, active, closed\n```\n\nRead these CSV files via HTTP, and write them as line-delimited JSON files. Ignore all fields beginning with underscore. Where possible, data should be converted to JSON native types (e.g. numbers, boolean).\n\n\n### 2. Read JSON files into Python objects\n\nFrom the files written in [step 1](#1-read-csv-files-via-http-and-write-as-json), read all JSON objects into collections of Python objects in memory. Fields should be accessible as attributes. Where possible, data should be converted into Python native types.\n\nStore collections of companies and opportunities such that each can be efficiently accessed randomly by their primary and foreign keys (if applicable), aiming for *O(1) average time complexity*.\n\n\n### 3. Generate company report\n\nFrom all data loaded into objects in memory, output a CSV file, containing:\n\n - company name\n - start date in mm/dd/yyyy format\n - total amount of opportunities\n - average opportunity amount\n - date of last opportunity update in mm/dd/yyyy format\n\n### 4. Generate summary report\n\nFrom all data loaded into objects in memory, output a CSV file that summarizes for target accounts and non-target accounts:\n\n - total opportunity amount\n - average opportunity amount\n\n\n### 5. Define SQL tables and queries\n\nFor the schemas above, define SQL tables, indexes, constraints, etc. that would be appropriate to handle millions of rows of data.\n\nFor the reports above, define the SQL queries that would generate similar results. It is not necessary to generate dates in any particular format, nor output in CSV.\n\n\n### 6. For discussion\n\n * Explain how you would test the efficiency of the SQL queries you wrote.\n\n * Explain how, if a SQL query was found to be inefficient, you would go about improving its performance.\n\n * Explain how typical SQL indexes work.\n\n * Explain the potential unintended consequences of adding an index to a table.\n\n * Explain what steps could you take to improve the performance of a one-time import of millions of rows.\n\n * Explain the differences between INNER JOIN, OUTER LEFT JOIN and OUTER RIGHT JOIN.\n\n * Explain whether SQL should enforce foreign key constraints, benefits and drawbacks.\n\n * Explain advantages and disadvantages of SQL vs. key-value databases.\n\n### 7. Generative AI (of course !)\n\nPlease remember to allocate some time for this little endeavour ! You should already have your own personal token for any of the AI models out there (we prefer the free kind ;) ).\n\n#### a. Chat Completion\n\nUsing the tool / toolkit of your choice write (in Python) a chat completion \"bot\". This should allow you to send a query to a model and return a response.\n\n#### b. Agents\n\nDescribe how you would handle more complex tasks (like retrievers, reasoning, function calling, etc.) : \n * What tools or framework would you use ?\n * What would be involved in fine-tuning the responses of that agent ?\n * How would you test the agent ?\n\n\u003e __HINT :__ you should allocate 15 min for this \"challenge\" ; it's completely fine to discuss and show us what you would do, in case you run out of time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpvisual%2Fcoding-ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnpvisual%2Fcoding-ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnpvisual%2Fcoding-ex/lists"}