๐ฅ Trending Repository: MinerU
๐ Description: Transforms complex documents like PDFs into LLM-ready markdown/JSON for your Agentic workflows.
๐ Repository URL: https://github.com/opendatalab/MinerU
๐ Website: https://opendatalab.github.io/MinerU/
๐ Readme: https://github.com/opendatalab/MinerU#readme
๐ Statistics:
๐ Stars: 45.7K stars
๐ Watchers: 183
๐ด Forks: 3.8K forks
๐ป Programming Languages: Python - Dockerfile
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: Transforms complex documents like PDFs into LLM-ready markdown/JSON for your Agentic workflows.
๐ Repository URL: https://github.com/opendatalab/MinerU
๐ Website: https://opendatalab.github.io/MinerU/
๐ Readme: https://github.com/opendatalab/MinerU#readme
๐ Statistics:
๐ Stars: 45.7K stars
๐ Watchers: 183
๐ด Forks: 3.8K forks
๐ป Programming Languages: Python - Dockerfile
๐ท๏ธ Related Topics:
#python #pdf #parser #ocr #pdf_converter #extract_data #document_analysis #pdf_parser #layout_analysis #ai4science #pdf_extractor_rag #pdf_extractor_llm #pdf_extractor_pretrain
==================================
๐ง By: https://t.iss.one/DataScienceM
โค1
๐ฅ Trending Repository: MineContext
๐ Description: MineContext is your proactive context-aware AI partner๏ผContext-Engineering+ChatGPT Pulse๏ผ
๐ Repository URL: https://github.com/volcengine/MineContext
๐ Readme: https://github.com/volcengine/MineContext#readme
๐ Statistics:
๐ Stars: 1.6K stars
๐ Watchers: 12
๐ด Forks: 72 forks
๐ป Programming Languages: Python - HTML - JavaScript - CSS
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: MineContext is your proactive context-aware AI partner๏ผContext-Engineering+ChatGPT Pulse๏ผ
๐ Repository URL: https://github.com/volcengine/MineContext
๐ Readme: https://github.com/volcengine/MineContext#readme
๐ Statistics:
๐ Stars: 1.6K stars
๐ Watchers: 12
๐ด Forks: 72 forks
๐ป Programming Languages: Python - HTML - JavaScript - CSS
๐ท๏ธ Related Topics:
#electron #react #python #agent #memory #python3 #embedding_models #rag #vector_database #vision_language_model #proactive_ai #context_engineering
==================================
๐ง By: https://t.iss.one/DataScienceM
โค1
๐ฅ Trending Repository: waha
๐ Description: WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! 3 engines: WEBJS (browser based), NOWEB (websocket nodejs), GOWS (websocket go)
๐ Repository URL: https://github.com/devlikeapro/waha
๐ Website: https://waha.devlike.pro/
๐ Readme: https://github.com/devlikeapro/waha#readme
๐ Statistics:
๐ Stars: 4.4K stars
๐ Watchers: 38
๐ด Forks: 922 forks
๐ป Programming Languages: TypeScript - JavaScript - HTML - Dockerfile - Shell - Makefile
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! 3 engines: WEBJS (browser based), NOWEB (websocket nodejs), GOWS (websocket go)
๐ Repository URL: https://github.com/devlikeapro/waha
๐ Website: https://waha.devlike.pro/
๐ Readme: https://github.com/devlikeapro/waha#readme
๐ Statistics:
๐ Stars: 4.4K stars
๐ Watchers: 38
๐ด Forks: 922 forks
๐ป Programming Languages: TypeScript - JavaScript - HTML - Dockerfile - Shell - Makefile
๐ท๏ธ Related Topics:
#bot #whatsapp #python_bot #whatsapp_web #whatsapp_bot #http_api #whatsapp_api #whatsapp_chat #ai_bot #whatsapp_automation #whatsapp_web_api
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: openarm
๐ Description: A fully open-source humanoid arm for physical AI research and deployment in contact-rich environments.
๐ Repository URL: https://github.com/enactic/openarm
๐ Website: https://openarm.dev
๐ Readme: https://github.com/enactic/openarm#readme
๐ Statistics:
๐ Stars: 1.1K stars
๐ Watchers: 36
๐ด Forks: 131 forks
๐ป Programming Languages: MDX - TypeScript
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: A fully open-source humanoid arm for physical AI research and deployment in contact-rich environments.
๐ Repository URL: https://github.com/enactic/openarm
๐ Website: https://openarm.dev
๐ Readme: https://github.com/enactic/openarm#readme
๐ Statistics:
๐ Stars: 1.1K stars
๐ Watchers: 36
๐ด Forks: 131 forks
๐ป Programming Languages: MDX - TypeScript
๐ท๏ธ Related Topics:
#python #open_source #machine_learning #reinforcement_learning #robot #robotics #genesis #robot_arm #force_feedback #imitation_learning #humanoid_robot #ros2 #bilateral_teleoperation #teleoperation #mujoco #moveit2 #gravity_compensation #openarm
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: reflex
๐ Description: ๐ธ๏ธ Web apps in pure Python ๐
๐ Repository URL: https://github.com/reflex-dev/reflex
๐ Website: https://reflex.dev
๐ Readme: https://github.com/reflex-dev/reflex#readme
๐ Statistics:
๐ Stars: 26.1K stars
๐ Watchers: 177
๐ด Forks: 1.6K forks
๐ป Programming Languages: Python - JavaScript - PowerShell - Shell - CSS - Dockerfile
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: ๐ธ๏ธ Web apps in pure Python ๐
๐ Repository URL: https://github.com/reflex-dev/reflex
๐ Website: https://reflex.dev
๐ Readme: https://github.com/reflex-dev/reflex#readme
๐ Statistics:
๐ Stars: 26.1K stars
๐ Watchers: 177
๐ด Forks: 1.6K forks
๐ป Programming Languages: Python - JavaScript - PowerShell - Shell - CSS - Dockerfile
๐ท๏ธ Related Topics:
#python #open_source #gui #framework #web
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: maltrail
๐ Description: Malicious traffic detection system
๐ Repository URL: https://github.com/stamparm/maltrail
๐ Readme: https://github.com/stamparm/maltrail#readme
๐ Statistics:
๐ Stars: 7.4K stars
๐ Watchers: 237
๐ด Forks: 1.2K forks
๐ป Programming Languages: Python - JavaScript - CSS - HTML
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: Malicious traffic detection system
๐ Repository URL: https://github.com/stamparm/maltrail
๐ Readme: https://github.com/stamparm/maltrail#readme
๐ Statistics:
๐ Stars: 7.4K stars
๐ Watchers: 237
๐ด Forks: 1.2K forks
๐ป Programming Languages: Python - JavaScript - CSS - HTML
๐ท๏ธ Related Topics:
#python #security #sensor #malware #intrusion_detection #network_monitoring #attack_detection
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: skyvern
๐ Description: Automate browser-based workflows with LLMs and Computer Vision
๐ Repository URL: https://github.com/Skyvern-AI/skyvern
๐ Website: https://www.skyvern.com
๐ Readme: https://github.com/Skyvern-AI/skyvern#readme
๐ Statistics:
๐ Stars: 14.7K stars
๐ Watchers: 84
๐ด Forks: 1.3K forks
๐ป Programming Languages: Python - TypeScript - MDX - Jinja - JavaScript - Shell
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: Automate browser-based workflows with LLMs and Computer Vision
๐ Repository URL: https://github.com/Skyvern-AI/skyvern
๐ Website: https://www.skyvern.com
๐ Readme: https://github.com/Skyvern-AI/skyvern#readme
๐ Statistics:
๐ Stars: 14.7K stars
๐ Watchers: 84
๐ด Forks: 1.3K forks
๐ป Programming Languages: Python - TypeScript - MDX - Jinja - JavaScript - Shell
๐ท๏ธ Related Topics:
#python #api #workflow #automation #browser #computer #vision #gpt #browser_automation #rpa #playwright #llm
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: best-of-ml-python
๐ Description: ๐ A ranked list of awesome machine learning Python libraries. Updated weekly.
๐ Repository URL: https://github.com/lukasmasuch/best-of-ml-python
๐ Website: https://ml-python.best-of.org
๐ Readme: https://github.com/lukasmasuch/best-of-ml-python#readme
๐ Statistics:
๐ Stars: 22.3K stars
๐ Watchers: 444
๐ด Forks: 3K forks
๐ป Programming Languages: Not available
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: ๐ A ranked list of awesome machine learning Python libraries. Updated weekly.
๐ Repository URL: https://github.com/lukasmasuch/best-of-ml-python
๐ Website: https://ml-python.best-of.org
๐ Readme: https://github.com/lukasmasuch/best-of-ml-python#readme
๐ Statistics:
๐ Stars: 22.3K stars
๐ Watchers: 444
๐ด Forks: 3K forks
๐ป Programming Languages: Not available
๐ท๏ธ Related Topics:
#python #nlp #data_science #machine_learning #deep_learning #tensorflow #scikit_learn #keras #ml #data_visualization #pytorch #transformer #data_analysis #gpt #automl #jax #data_visualizations #gpt_3 #chatgpt
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ฅ Trending Repository: social-analyzer
๐ Description: API, CLI, and Web App for analyzing and finding a person's profile in 1000 social media \ websites
๐ Repository URL: https://github.com/qeeqbox/social-analyzer
๐ Readme: https://github.com/qeeqbox/social-analyzer#readme
๐ Statistics:
๐ Stars: 13.9K stars
๐ Watchers: 374
๐ด Forks: 1.2K forks
๐ป Programming Languages: JavaScript
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: API, CLI, and Web App for analyzing and finding a person's profile in 1000 social media \ websites
๐ Repository URL: https://github.com/qeeqbox/social-analyzer
๐ Readme: https://github.com/qeeqbox/social-analyzer#readme
๐ Statistics:
๐ Stars: 13.9K stars
๐ Watchers: 374
๐ด Forks: 1.2K forks
๐ป Programming Languages: JavaScript
๐ท๏ธ Related Topics:
#nodejs #javascript #python #cli #profile #social_media #osint #analysis #analyzer #pentesting #username #pentest #nodejs_cli #information_gathering #security_tools #reconnaissance #social_analyzer #person_profile #sosint
==================================
๐ง By: https://t.iss.one/DataScienceM
โค1
Forwarded from Data Science Machine Learning Data Analysis
In Python, building AI-powered Telegram bots unlocks massive potential for image generation, processing, and automationโmaster this to create viral tools and ace full-stack interviews! ๐ค
Learn more: https://hackmd.io/@husseinsheikho/building-AI-powered-Telegram-bots
https://t.iss.one/DataScienceM๐ฆพ
# Basic Bot Setup - The foundation (PTB v20+ Async)
from telegram.ext import Application, CommandHandler, MessageHandler, filters
async def start(update, context):
await update.message.reply_text(
"โจ AI Image Bot Active!\n"
"/generate - Create images from text\n"
"/enhance - Improve photo quality\n"
"/help - Full command list"
)
app = Application.builder().token("YOUR_BOT_TOKEN").build()
app.add_handler(CommandHandler("start", start))
app.run_polling()
# Image Generation - DALL-E Integration (OpenAI)
import openai
from telegram.ext import ContextTypes
openai.api_key = os.getenv("OPENAI_API_KEY")
async def generate(update: Update, context: ContextTypes.DEFAULT_TYPE):
if not context.args:
await update.message.reply_text("โ Usage: /generate cute robot astronaut")
return
prompt = " ".join(context.args)
try:
response = openai.Image.create(
prompt=prompt,
n=1,
size="1024x1024"
)
await update.message.reply_photo(
photo=response['data'][0]['url'],
caption=f"๐จ Generated: *{prompt}*",
parse_mode="Markdown"
)
except Exception as e:
await update.message.reply_text(f"๐ฅ Error: {str(e)}")
app.add_handler(CommandHandler("generate", generate))
Learn more: https://hackmd.io/@husseinsheikho/building-AI-powered-Telegram-bots
#Python #TelegramBot #AI #ImageGeneration #StableDiffusion #OpenAI #MachineLearning #CodingInterview #FullStack #Chatbots #DeepLearning #ComputerVision #Programming #TechJobs #DeveloperTips #CareerGrowth #CloudComputing #Docker #APIs #Python3 #Productivity #TechTips
https://t.iss.one/DataScienceM
Please open Telegram to view this post
VIEW IN TELEGRAM
โค4
๐ฅ Trending Repository: mem0
๐ Description: Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management.
๐ Repository URL: https://github.com/mem0ai/mem0
๐ Website: https://mem0.ai
๐ Readme: https://github.com/mem0ai/mem0#readme
๐ Statistics:
๐ Stars: 42.1K stars
๐ Watchers: 203
๐ด Forks: 4.5K forks
๐ป Programming Languages: Python - TypeScript - MDX - Jupyter Notebook - JavaScript - Shell
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management.
๐ Repository URL: https://github.com/mem0ai/mem0
๐ Website: https://mem0.ai
๐ Readme: https://github.com/mem0ai/mem0#readme
๐ Statistics:
๐ Stars: 42.1K stars
๐ Watchers: 203
๐ด Forks: 4.5K forks
๐ป Programming Languages: Python - TypeScript - MDX - Jupyter Notebook - JavaScript - Shell
๐ท๏ธ Related Topics:
#python #application #state_management #ai #memory #chatbots #memory_management #agents #hacktoberfest #ai_agents #long_term_memory #rag #llm #chatgpt #genai
==================================
๐ง By: https://t.iss.one/DataScienceM
โค1
#YOLOv8 #ComputerVision #ObjectDetection #Python #AI
Audience Analysis with YOLOv8: Counting People & Estimating Gender Ratios
This lesson demonstrates how to use the YOLOv8 model to perform a computer vision task: analyzing an image of a crowd to count the total number of people and estimate the ratio of men to women.
---
Step 1: Setup and Installation
First, we need to install the necessary libraries.
#Setup #Installation
---
Step 2: Loading Models and Image
We will load two models: the official YOLOv8 model pre-trained for object detection, and we'll use
#DataLoading #Model
---
Step 3: Person Detection with YOLOv8
Now, we'll run the YOLOv8 model on our image to detect all objects and then filter those results to keep only the ones identified as a 'person'.
#PersonDetection #Inference
---
Step 4: Gender Classification
For each detected person, we will crop their bounding box from the image. Then, we'll use
#GenderClassification #CV
Audience Analysis with YOLOv8: Counting People & Estimating Gender Ratios
This lesson demonstrates how to use the YOLOv8 model to perform a computer vision task: analyzing an image of a crowd to count the total number of people and estimate the ratio of men to women.
---
Step 1: Setup and Installation
First, we need to install the necessary libraries.
ultralytics for the YOLOv8 model, opencv-python for image manipulation, and cvlib for a simple, pre-trained gender classification model.#Setup #Installation
# Open your terminal or command prompt and run:
pip install ultralytics opencv-python cvlib tensorflow
---
Step 2: Loading Models and Image
We will load two models: the official YOLOv8 model pre-trained for object detection, and we'll use
cvlib for gender detection. We also need to load the image we want to analyze. Make sure you have an image named crowd.jpg in the same directory.#DataLoading #Model
import cv2
from ultralytics import YOLO
import cvlib as cv
import numpy as np
# Load the YOLOv8 model (pre-trained on COCO dataset)
model = YOLO('yolov8n.pt')
# Load the image
image_path = 'crowd.jpg' # Make sure this image exists
img = cv2.imread(image_path)
# Check if the image was loaded correctly
if img is None:
print(f"Error: Could not load image from {image_path}")
else:
print("Image and YOLOv8 model loaded successfully.")
---
Step 3: Person Detection with YOLOv8
Now, we'll run the YOLOv8 model on our image to detect all objects and then filter those results to keep only the ones identified as a 'person'.
#PersonDetection #Inference
# Run inference on the image
results = model(img)
# A list to store the bounding boxes of detected people
person_boxes = []
# Process the results
for result in results:
boxes = result.boxes
for box in boxes:
# Get class id and check if it's a person (class 0 in COCO)
if model.names[int(box.cls)] == 'person':
# Get bounding box coordinates
x1, y1, x2, y2 = map(int, box.xyxy[0])
person_boxes.append((x1, y1, x2, y2))
# Print the total number of people found
total_people = len(person_boxes)
print(f"Total people detected: {total_people}")
---
Step 4: Gender Classification
For each detected person, we will crop their bounding box from the image. Then, we'll use
cvlib to detect a face within that crop and predict the gender. This is a multi-step pipeline.#GenderClassification #CV
๐ฅ Trending Repository: xiaomusic
๐ Description: ไฝฟ็จๅฐ็ฑ้ณ็ฎฑๆญๆพ้ณไน๏ผ้ณไนไฝฟ็จ yt-dlp ไธ่ฝฝใ
๐ Repository URL: https://github.com/hanxi/xiaomusic
๐ Website: https://xdocs.hanxi.cc/
๐ Readme: https://github.com/hanxi/xiaomusic#readme
๐ Statistics:
๐ Stars: 6.4K stars
๐ Watchers: 22
๐ด Forks: 637 forks
๐ป Programming Languages: Python
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: ไฝฟ็จๅฐ็ฑ้ณ็ฎฑๆญๆพ้ณไน๏ผ้ณไนไฝฟ็จ yt-dlp ไธ่ฝฝใ
๐ Repository URL: https://github.com/hanxi/xiaomusic
๐ Website: https://xdocs.hanxi.cc/
๐ Readme: https://github.com/hanxi/xiaomusic#readme
๐ Statistics:
๐ Stars: 6.4K stars
๐ Watchers: 22
๐ด Forks: 637 forks
๐ป Programming Languages: Python
๐ท๏ธ Related Topics:
#python #music #docker #vue #docker_compose #xiaomi #pdm #xiaoai #xiaoai_speaker #xiaomusic
==================================
๐ง By: https://t.iss.one/DataScienceM
#YOLOv8 #ComputerVision #HomeSecurity #ObjectTracking #AI #Python
Lesson: Tracking Suspicious Individuals Near a Home at Night with YOLOv8
This tutorial demonstrates how to build an advanced security system using YOLOv8's object tracking capabilities. The system will detect people in a night-time video feed, track their movements, and trigger an alert if a person loiters for too long within a predefined "alert zone" (e.g., a driveway or porch).
---
We will use
Create a Python script (e.g.,
---
We will load a standard YOLOv8 model capable of detecting 'person'. The key is to define a polygon representing the area we want to monitor. We will also set a time threshold to define "loitering". You will need a video file of your target area, for example,
---
This is the core of the system. We will read the video frame by frame and use YOLOv8's
(Note: The code below should be placed inside the
---
Inside the main loop, we'll iterate through each tracked person. We check if their position is inside our alert zone. If it is, we start or update a timer. If the timer exceeds our threshold, we trigger an alert for that person's ID.
Lesson: Tracking Suspicious Individuals Near a Home at Night with YOLOv8
This tutorial demonstrates how to build an advanced security system using YOLOv8's object tracking capabilities. The system will detect people in a night-time video feed, track their movements, and trigger an alert if a person loiters for too long within a predefined "alert zone" (e.g., a driveway or porch).
---
#Step 1: Project Setup and DependenciesWe will use
ultralytics for YOLOv8 and its built-in tracker, opencv-python for video processing, and numpy for defining our security zone.pip install ultralytics opencv-python numpy
Create a Python script (e.g.,
security_tracker.py) and import the necessary libraries. We'll also use defaultdict to easily manage timers for each tracked person.import cv2
import numpy as np
from ultralytics import YOLO
from collections import defaultdict
import time
# Hashtags: #Setup #Python #OpenCV #YOLOv8
---
#Step 2: Model Loading and Zone ConfigurationWe will load a standard YOLOv8 model capable of detecting 'person'. The key is to define a polygon representing the area we want to monitor. We will also set a time threshold to define "loitering". You will need a video file of your target area, for example,
night_security_footage.mp4.# Load the YOLOv8 model
model = YOLO('yolov8n.pt')
# Path to your night-time video file
VIDEO_PATH = 'night_security_footage.mp4'
# Define the polygon for the alert zone.
# IMPORTANT: You MUST adjust these [x, y] coordinates to fit your video's perspective.
# This example defines a rectangular area for a driveway.
ALERT_ZONE_POLYGON = np.array([
[100, 500], [800, 500], [850, 250], [50, 250]
], np.int32)
# Time in seconds a person can be in the zone before an alert is triggered
LOITERING_THRESHOLD_SECONDS = 5.0
# Dictionaries to store tracking data
# Stores the time when a tracked object first enters the zone
loitering_timers = {}
# Stores the IDs of individuals who have triggered an alert
alert_triggered_ids = set()
# Hashtags: #Configuration #AIModel #SecurityZone
---
#Step 3: Main Loop for Tracking and Zone MonitoringThis is the core of the system. We will read the video frame by frame and use YOLOv8's
track() function. This function not only detects objects but also assigns a unique ID to each one, allowing us to follow them across frames.cap = cv2.VideoCapture(VIDEO_PATH)
while cap.isOpened():
success, frame = cap.read()
if not success:
break
# Run YOLOv8 tracking on the frame, persisting tracks between frames
results = model.track(frame, persist=True)
# Get the bounding boxes and track IDs
boxes = results[0].boxes.xywh.cpu()
track_ids = results[0].boxes.id.int().cpu().tolist()
# Visualize the results on the frame
annotated_frame = results[0].plot()
# Draw the alert zone polygon on the frame
cv2.polylines(annotated_frame, [ALERT_ZONE_POLYGON], isClosed=True, color=(0, 255, 255), thickness=2)
# Hashtags: #RealTime #ObjectTracking #VideoProcessing
(Note: The code below should be placed inside the
while loop of Step 3)---
#Step 4: Implementing Loitering Logic and AlertsInside the main loop, we'll iterate through each tracked person. We check if their position is inside our alert zone. If it is, we start or update a timer. If the timer exceeds our threshold, we trigger an alert for that person's ID.
#PyQt5 #SQLite #DesktopApp #Pharmacy #Barcode #Python
Lesson: Building a Pharmacy Management System with PyQt5 and Barcode Scanning
This tutorial will guide you through creating a complete desktop application for managing a pharmacy. The system will use a SQLite database for inventory, and a Point of Sale (POS) interface that uses barcode scanning to add drugs to a sale and automatically deducts stock upon completion.
---
First, we create a dedicated file to handle all SQLite database operations. This keeps our data logic separate from our UI logic. Create a file named
---
Create the main application file,
Lesson: Building a Pharmacy Management System with PyQt5 and Barcode Scanning
This tutorial will guide you through creating a complete desktop application for managing a pharmacy. The system will use a SQLite database for inventory, and a Point of Sale (POS) interface that uses barcode scanning to add drugs to a sale and automatically deducts stock upon completion.
---
#Step 1: Database Setup (database.py)First, we create a dedicated file to handle all SQLite database operations. This keeps our data logic separate from our UI logic. Create a file named
database.py.import sqlite3
DB_NAME = 'pharmacy.db'
def connect():
return sqlite3.connect(DB_NAME)
def setup_database():
conn = connect()
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS drugs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
barcode TEXT NOT NULL UNIQUE,
quantity INTEGER NOT NULL,
price REAL NOT NULL,
expiry_date TEXT NOT NULL
)
''')
conn.commit()
conn.close()
def add_drug(name, barcode, quantity, price, expiry_date):
conn = connect()
cursor = conn.cursor()
try:
cursor.execute("INSERT INTO drugs (name, barcode, quantity, price, expiry_date) VALUES (?, ?, ?, ?, ?)",
(name, barcode, quantity, price, expiry_date))
conn.commit()
except sqlite3.IntegrityError:
return False # Barcode already exists
finally:
conn.close()
return True
def get_all_drugs():
conn = connect()
cursor = conn.cursor()
cursor.execute("SELECT id, name, barcode, quantity, price, expiry_date FROM drugs ORDER BY name")
drugs = cursor.fetchall()
conn.close()
return drugs
def find_drug_by_barcode(barcode):
conn = connect()
cursor = conn.cursor()
cursor.execute("SELECT id, name, barcode, quantity, price, expiry_date FROM drugs WHERE barcode = ?", (barcode,))
drug = cursor.fetchone()
conn.close()
return drug
def update_drug_quantity(drug_id, sold_quantity):
conn = connect()
cursor = conn.cursor()
cursor.execute("UPDATE drugs SET quantity = quantity - ? WHERE id = ?", (sold_quantity, drug_id))
conn.commit()
conn.close()
# Hashtags: #SQLite #DatabaseDesign #DataPersistence #Python
---
#Step 2: Main Application and Inventory Management UICreate the main application file,
main.py. We will set up the main window with tabs for "Point of Sale" and "Inventory Management". We will fully implement the inventory tab first, allowing users to view and add drugs to the database.๐ฅ Trending Repository: pytorch
๐ Description: Tensors and Dynamic neural networks in Python with strong GPU acceleration
๐ Repository URL: https://github.com/pytorch/pytorch
๐ Website: https://pytorch.org
๐ Readme: https://github.com/pytorch/pytorch#readme
๐ Statistics:
๐ Stars: 94.5K stars
๐ Watchers: 1.8k
๐ด Forks: 25.8K forks
๐ป Programming Languages: Python - C++ - Cuda - C - Objective-C++ - CMake
๐ท๏ธ Related Topics:
==================================
๐ง By: https://t.iss.one/DataScienceM
๐ Description: Tensors and Dynamic neural networks in Python with strong GPU acceleration
๐ Repository URL: https://github.com/pytorch/pytorch
๐ Website: https://pytorch.org
๐ Readme: https://github.com/pytorch/pytorch#readme
๐ Statistics:
๐ Stars: 94.5K stars
๐ Watchers: 1.8k
๐ด Forks: 25.8K forks
๐ป Programming Languages: Python - C++ - Cuda - C - Objective-C++ - CMake
๐ท๏ธ Related Topics:
#python #machine_learning #deep_learning #neural_network #gpu #numpy #autograd #tensor
==================================
๐ง By: https://t.iss.one/DataScienceM
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "myDynamicElement"))
)
โข Get the page source after JavaScript has executed.
dynamic_html = driver.page_source
โข Close the browser window.
driver.quit()
VII. Common Tasks & Best Practices
โข Handle pagination by finding the "Next" link.
next_page_url = soup.find('a', text='Next')['href']โข Save data to a CSV file.
import csv
with open('data.csv', 'w', newline='', encoding='utf-8') as f:
writer = csv.writer(f)
writer.writerow(['Title', 'Link'])
# writer.writerow([title, url]) in a loop
โข Save data to CSV using
pandas.import pandas as pd
df = pd.DataFrame(data, columns=['Title', 'Link'])
df.to_csv('data.csv', index=False)
โข Use a proxy with
requests.proxies = {'http': 'https://10.10.1.10:3128', 'https': 'https://10.10.1.10:1080'}
requests.get('https://example.com', proxies=proxies)โข Pause between requests to be polite.
import time
time.sleep(2) # Pause for 2 seconds
โข Handle JSON data from an API.
json_response = requests.get('https://api.example.com/data').json()โข Download a file (like an image).
img_url = 'https://example.com/image.jpg'
img_data = requests.get(img_url).content
with open('image.jpg', 'wb') as handler:
handler.write(img_data)
โข Parse a
sitemap.xml to find all URLs.# Get the sitemap.xml file and parse it like any other XML/HTML to extract <loc> tags.
VIII. Advanced Frameworks (
Scrapy)โข Create a Scrapy spider (conceptual command).
scrapy genspider example example.com
โข Define a
parse method to process the response.# In your spider class:
def parse(self, response):
# parsing logic here
pass
โข Extract data using Scrapy's CSS selectors.
titles = response.css('h1::text').getall()โข Extract data using Scrapy's XPath selectors.
links = response.xpath('//a/@href').getall()โข Yield a dictionary of scraped data.
yield {'title': response.css('title::text').get()}โข Follow a link to parse the next page.
next_page = response.css('li.next a::attr(href)').get()
if next_page is not None:
yield response.follow(next_page, callback=self.parse)โข Run a spider from the command line.
scrapy crawl example -o output.json
โข Pass arguments to a spider.
scrapy crawl example -a category=books
โข Create a Scrapy Item for structured data.
import scrapy
class ProductItem(scrapy.Item):
name = scrapy.Field()
price = scrapy.Field()
โข Use an Item Loader to populate Items.
from scrapy.loader import ItemLoader
loader = ItemLoader(item=ProductItem(), response=response)
loader.add_css('name', 'h1.product-name::text')
#Python #WebScraping #BeautifulSoup #Selenium #Requests
โโโโโโโโโโโโโโโ
By: @DataScienceN โจ
โค2