Skip to content

Commit 1c5e67e

Browse files
init
0 parents  commit 1c5e67e

26 files changed

Lines changed: 2295 additions & 0 deletions

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
.Python
6+
env/
7+
venv/
8+
node_modules/
9+
.env
10+
.venv
11+
*.log
12+
.DS_Store
13+
dist/
14+
build/
15+
*.egg-info/
16+
.pytest_cache/
17+
.coverage
18+
htmlcov/
19+
frontend/build/

README.md

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Lab Automation System - Technical Exercise
2+
3+
## Overview
4+
5+
Welcome to the Lab Automation System technical exercise! This is a microservice-based application for managing laboratory workflows and devices. Your task is to debug existing issues and implement a new feature.
6+
7+
**Time allocation: 60-90 minutes**
8+
9+
## System Architecture
10+
11+
The system consists of:
12+
13+
- **Frontend**: React application (port 3000)
14+
- **Backend Microservices**:
15+
- `workflow-service`: Manages automation workflows (port 5003)
16+
- `device-service`: Controls lab equipment (port 5001)
17+
- `sample-service`: Tracks samples (port 5002)
18+
- **Infrastructure**: Redis for caching and state management
19+
20+
## Getting Started
21+
22+
### Prerequisites
23+
24+
- Docker and Docker Compose
25+
- Git
26+
27+
### Setup
28+
29+
1. Clone this repository (if not already done)
30+
2. Navigate to the project directory
31+
3. Start the system:
32+
33+
```bash
34+
docker-compose up --build
35+
```
36+
37+
4. Access the application:
38+
- Frontend: http://localhost:3000
39+
- Workflow Service: http://localhost:5003
40+
- Device Service: http://localhost:5001
41+
- Sample Service: http://localhost:5002
42+
43+
## Exercise Structure
44+
45+
This exercise is divided into two phases:
46+
47+
### Phase 1: Debugging (30-40 minutes)
48+
49+
The system currently has several bugs that prevent it from working correctly. Your task is to identify and fix them.
50+
51+
**Scenario**: A lab technician reports that they cannot start workflows. The system appears to have multiple issues.
52+
53+
**Known Issues**:
54+
1. One or more services fail to start
55+
2. Workflows cannot be started successfully
56+
3. Device status display is incorrect
57+
4. System has race conditions under concurrent load
58+
59+
**Your Tasks**:
60+
- Get all services running correctly
61+
- Enable workflows to be created and started successfully
62+
- Ensure device status updates correctly in the UI
63+
- Identify and fix the race condition in device booking
64+
65+
**Tips**:
66+
- Check service logs: `docker-compose logs [service-name]`
67+
- Use browser DevTools to inspect API calls
68+
- Test the system end-to-end after each fix
69+
70+
### Phase 2: Feature Implementation (30-50 minutes)
71+
72+
Implement a **Workflow Pause/Resume** feature that allows users to pause running workflows and resume them later.
73+
74+
**Requirements**:
75+
76+
**Backend** (`workflow-service`):
77+
- Add `POST /workflows/<workflow_id>/pause` endpoint
78+
- Should release the device (but mark it as resumable)
79+
- Update workflow status to "paused"
80+
- Store any necessary state for resuming
81+
- Add `POST /workflows/<workflow_id>/resume` endpoint
82+
- Should re-book the device
83+
- Update workflow status back to "running"
84+
- Handle errors gracefully (e.g., device no longer available)
85+
86+
**Frontend**:
87+
- Add "Pause" button for workflows with status "running"
88+
- Add "Resume" button for workflows with status "paused"
89+
- Handle loading and error states appropriately
90+
- Update the UI to distinguish paused workflows visually
91+
92+
**Integration**:
93+
- Ensure device status updates correctly when paused/resumed
94+
- Test the complete flow: create → start → pause → resume → complete
95+
96+
## Evaluation Criteria
97+
98+
We're looking for:
99+
100+
**System Understanding**: Can you trace requests across services? Do you understand the architecture?
101+
102+
**Debugging Skills**: Do you use a methodical approach? Check logs? Use appropriate debugging tools?
103+
104+
**Full-Stack Competency**: Are you comfortable working across React and Python? Can you switch contexts effectively?
105+
106+
**Problem-Solving**: When you don't know something, do you know how to find the answer?
107+
108+
**Code Quality**: Is your implementation clean, well-structured, and maintainable?
109+
110+
**Communication**: Do you explain your thought process? Ask clarifying questions?
111+
112+
## Useful Commands
113+
114+
```bash
115+
# View logs for all services
116+
docker-compose logs -f
117+
118+
# View logs for specific service
119+
docker-compose logs -f workflow-service
120+
121+
# Restart a specific service
122+
docker-compose restart workflow-service
123+
124+
# Rebuild and restart
125+
docker-compose up --build
126+
127+
# Stop all services
128+
docker-compose down
129+
130+
# Check if services are healthy
131+
curl http://localhost:5001/health
132+
curl http://localhost:5002/health
133+
curl http://localhost:5003/health
134+
```
135+
136+
## API Documentation
137+
138+
### Workflow Service
139+
140+
- `GET /workflows` - List all workflows
141+
- `POST /workflows` - Create workflow
142+
```json
143+
{
144+
"name": "PCR Setup",
145+
"device_id": "liquid-handler-1",
146+
"sample_barcodes": ["SAMPLE001"],
147+
"steps": ["Aspirate 10uL", "Dispense to A1"]
148+
}
149+
```
150+
- `POST /workflows/<id>/start` - Start workflow
151+
- `POST /workflows/<id>/complete` - Complete workflow
152+
153+
### Device Service
154+
155+
- `GET /devices` - List all devices
156+
- `GET /devices/<id>` - Get device details
157+
- `POST /devices/<id>/book` - Book device for workflow
158+
- `POST /devices/<id>/release` - Release device
159+
160+
### Sample Service
161+
162+
- `GET /samples` - List all samples
163+
- `GET /samples/<barcode>` - Get sample details
164+
- `POST /samples/validate` - Validate sample barcodes
165+
166+
## Questions?
167+
168+
Feel free to ask questions at any time! We're interested in how you approach problems and work through challenges, not just whether you can find all the bugs immediately.
169+
170+
Good luck! 🚀

0 commit comments

Comments
 (0)