Welcome to the programming exercise for React Frontend Developers! :)
Your task is to implement a simple prototype of a medication recommendation chat bot. Please use this Figma mockup as orientation.
Your implementation should:
- Greet the user on a welcome screen and allow them to select a medical condition
- Ask a refinement question (duration of the condition) with a number of pre-defined answers (less than 3 days, at least three days)
- Display a recommendation using the results from the JSON API based on
db.json
(start it usingyarn up:dev
, see below)- Use the filtering logic it provides to select the right drug:
GET http://localhost:3000/drugs?duration=SHORT
returns all drugs applicable if a condition persists for less than 3 daysGET http://localhost:3000/drugs?duration=LONG
returns all drugs applicable if a condition persists for at least 3 days
- Note: As part of this exercise, only the duration of the condition has to be used for filtering since the drugs contained in the
db.json
apply to all conditions the user could select
- Use the filtering logic it provides to select the right drug:
In the process, you should:
- Develop a reusable button component, styling it using styled-components
- Implement your state management and request logic by extending the
RootStore
. Use MobX where applicable - Assemble the screen(s) in the Figma design and bring them to live using your logic
- Optional: Use Axios and React Query to fetch the API data
- If you do not use Axios and React Query, pick a fitting alternative
In general, this exercise is not about developing a functionally complete solution. Our primary focus in evaluating it is the quality of your code and architecture. Your goal should be to get whatever you implement as close as possible to a production-ready state. This could, for example, include proper internationalization, accessibility hints, etc. Feel free to implement a subset of the functions described above as long as you feel confident you can demonstrate your development skills sufficiently.
- Install node.js and the Yarn package manager.
- After cloning the repository, run
yarn
in its root to install all dependencies and set up the git hooks. - Optional: Configure VSCode as described in "Editor Setup" below.
- Run
yarn up:dev
to start the API server. - In a second terminal, start the application using
yarn start
. Happy coding!
Note: See "Available Scripts" below for more information.
All files should be named in lower-case-with-dashes.ts
. There is no exception in casing for files holding a component.
TypeScript files (usually .ts
) using React's JSX syntax should receive a .tsx
file extension.
The contents of this repo are structured in the following way:
.vscode/
: VSCode configbuild/
: Build artifacts (excluded from version control)public/
: Assets copied over to distributionsrc/
: The application's source filesapp/
: The app's entry pointcomponents/
: Application-specific React components that do not hook into the application storei18n/
: Internationalization helpers & translationsmodels/
: MobX modelsscreens/
: All application screens accessible via their own route/as part of the navigation hierarchytheme/
: The UI theme
The most important scripts are outlined below. You can find all script definitions in the package.json
.
Launches a development server that runs the application in development mode.
After running this command, navigate to http://localhost:4200 to view the app in your browser.
The app will automatically reload if you change any of the source files.
Starts the JSON API server based on the db.json
file.
After running this command, the API will be available at http://localhost:3000.
The API will automatically reflect changes in the db.json
.
Runs automated code formatting on all applicable file types.
Lints all applicable files and prints the output.
Dry-runs the TypeScript compiler.
This is especially useful to check whether any types or references broke after a big refactoring.
Runs unit tests via Jest.
Tests are automatically discovered from all *.spec.{ts,tsx}
files.
Launches Storybook.
Stories are automatically added from all *.stories.{ts,tsx}
files.
Builds the application.
The build artifacts will be stored in the build/
directory.
We recommend using VSCode.
After opening the repo in VSCode, it will ask you if you want to install recommend extensions. For a seamless development experience, we recommend accepting.