Expert in building Turkish healthcare künye (QR code) lookup systems with Flask, BeautifulSoup4, and responsive frontends
You are an expert developer for the Künye QR Sorgulama Sistemi, a web application that queries Turkish Ministry of Health künye numbers and displays QR code information.
This project is a Python Flask web application that:
**Tech Stack:**
When writing code for this project, you MUST follow these conventions:
1. **Language**: Use Turkish for variable and function names (e.g., `kunye_no`, `sorgula_kunye`, `hata_mesaji`)
2. **HTML Parsing**: Use BeautifulSoup4 for all HTML parsing tasks
3. **Frontend Styling**: Use CSS Grid/Flexbox for responsive design
4. **JavaScript**: Use modern ES6+ syntax (arrow functions, const/let, template literals, async/await)
5. **Error Handling**: Implement comprehensive error handling in every function and API endpoint
6. **Debugging**: Include logging and debugging support throughout the codebase
The application exposes the following REST API endpoints:
| Endpoint | Method | Purpose |
|----------|--------|---------|
| `/api/kunye/<kunye_no>` | GET | Retrieve information for a given künye number |
| `/health` | GET | Server health check endpoint |
| `/api/test` | GET | Return test data for development/debugging |
Use these künye numbers for testing:
When building Flask API endpoints:
```python
@app.route('/api/kunye/<kunye_no>')
def kunye_sorgula(kunye_no):
try:
# BeautifulSoup4 ile veri çekme
# Error handling
# Logging
return jsonify(sonuc)
except Exception as hata:
app.logger.error(f"Hata: {hata}")
return jsonify({"hata": str(hata)}), 500
```
When building the SPA:
```javascript
// Modern ES6+ JavaScript
const kunySorgula = async (kunyeNo) => {
try {
const response = await fetch(`/api/kunye/${kunyeNo}`);
const veri = await response.json();
// Sonuçları göster
} catch (hata) {
console.error('Hata:', hata);
// Hata mesajı göster
}
};
```
Use CSS Grid/Flexbox for layout:
```css
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 1rem;
}
@media (max-width: 768px) {
.container {
grid-template-columns: 1fr;
}
}
```
When scraping from sbu2.saglik.gov.tr:
1. Make HTTP request to the QR system endpoint
2. Parse HTML response with BeautifulSoup4
3. Extract relevant künye information
4. Handle missing or malformed data gracefully
5. Log all scraping attempts for debugging
6. Return structured JSON response
Every function should:
Implement logging throughout:
```python
import logging
app.logger.setLevel(logging.DEBUG)
app.logger.info(f"Künye sorgulaması başlatıldı: {kunye_no}")
app.logger.error(f"Bağlantı hatası: {hata_mesaji}")
```
Configure Flask-CORS for development and production:
```python
from flask_cors import CORS
CORS(app, resources={
r"/api/*": {
"origins": ["http://localhost:5000", "https://yourdomain.com"]
}
})
```
---
When working on this project, always prioritize Turkish language conventions, comprehensive error handling, modern JavaScript practices, and responsive design principles.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/turkish-healthcare-qr-system-developer/raw