You are tasked with building a backend service and a database for a pharmacy platform using the following two raw datasets:
Link: data/pharmacies.json
This dataset contains a list of pharmacies with their names, opening hours, cash balances, and mask products. The cash balance represents the amount of money a pharmacy holds in its merchant account on this platform.
Be cautious when processing the
openingHours
field inpharmacies.json
, as it contains various time formats.
Link: data/users.json
This dataset contains a list of users with their names, cash balances, and purchasing histories. The cash balance represents the amount of money a user holds in their wallet on this platform.
These datasets are raw, meaning you can process and transform the data before loading it into your database.
Your task is to build an API server with proper documentation and a relational database to allow a front-end client to navigate the data quickly and intuitively. The front-end team will rely on your documentation to build the client application.
The front-end team requires the following operations to be supported:
- List all pharmacies open at a specific time and on a day of the week if requested.
- List all masks sold by a given pharmacy, sorted by mask name or price.
- List all pharmacies with more or fewer than
x
mask products within a specific price range. - Retrieve the top
x
users by total transaction amount of masks within a date range. - Calculate the total number of masks and the total transaction value within a date range.
- Search for pharmacies or masks by name and rank the results by relevance to the search term.
- Handle the process of a user purchasing masks, possibly from different pharmacies.
In your repository, you MUST include:
- Documentation for the API interface.
- Commands to run the ETL (Extract, Transform, and Load) script, which processes the raw datasets and loads them into your database.
- Commands to set up the server and database.
If you find the requirements insufficiently detailed, design your solution to be as realistic and practical as possible.
- Fork this repository to your GitHub account.
- Write an introduction to your work in response.md.
- Notify HR via email once you have completed the task. Include necessary details such as your GitHub account and the repository URL.
- Missing documentation.
- A project that does not function as intended.
- A solution that fails to meet the requirements.
- Poor version control practices:
- Avoid including temporary, redundant, or binary files (e.g.,
.DS_Store
,.idea
,.vscode
) in the repository. Use an appropriate .gitignore.
- Avoid including temporary, redundant, or binary files (e.g.,
Your project will be reviewed by at least one backend engineer.
- (40%) Familiarity with the programming language and framework:
- Code Quality:
- Is the code simple, easy to understand, extendable, reusable, and maintainable?
- Does the code avoid unnecessary comments or redundant blocks?
- Is the coding style consistent with language guidelines?
- Are there any obvious security vulnerabilities?
- Logic Design:
- Does the database design meet the requirements and remain easy to understand and extend?
- Is the raw data imported and cleaned effectively before being loaded into the database?
- Does the API logic meet the requirements and reflect real-world scenarios?
- MVC Architecture (optional):
- Does the design pattern align with the framework's guidelines?
- If using a framework, does the solution avoid reinventing the wheel?
- Code Quality:
- (30%) Completion of task requirements.
- (20%) API Quality:
- Can the API evolve and add functionality independently of client applications? As the API grows, can existing client applications continue functioning without modification?
- Are all functionalities discoverable, enabling client applications to fully utilize them?
- Avoid any 5xx errors when the API is called.
- (10%) Communication:
- Is the API documentation clear and easy for front-end engineers to understand?
These are optional and serve as additional proof of your skills. The project will still be considered complete without these features. If you are applying for a Senior Back-End Engineer position, you MUST complete all bonus tasks.