{"id":26795921,"url":"https://github.com/ebodshojaei/sentinel_ai","last_synced_at":"2025-03-29T18:16:28.908Z","repository":{"id":285018475,"uuid":"956817053","full_name":"EbodShojaei/Sentinel_AI","owner":"EbodShojaei","description":"Retrieve PubMed publications using phi3.5 with phidata to generate and run a Mesh search on NCBI Entrez. ","archived":false,"fork":false,"pushed_at":"2025-03-28T23:25:57.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T00:24:51.955Z","etag":null,"topics":["biopython","dotenv","entrez","ncbi","ollama","pandas","phi3","phidata","pubmed","python","sqlalchemy","xlsx"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EbodShojaei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T23:06:59.000Z","updated_at":"2025-03-28T23:26:57.000Z","dependencies_parsed_at":"2025-03-29T00:25:04.997Z","dependency_job_id":"07f4a9f4-c542-4f93-a410-2978baa5333d","html_url":"https://github.com/EbodShojaei/Sentinel_AI","commit_stats":null,"previous_names":["ebodshojaei/sentinel_ai"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EbodShojaei%2FSentinel_AI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EbodShojaei%2FSentinel_AI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EbodShojaei%2FSentinel_AI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EbodShojaei%2FSentinel_AI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EbodShojaei","download_url":"https://codeload.github.com/EbodShojaei/Sentinel_AI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223325,"owners_count":20743168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biopython","dotenv","entrez","ncbi","ollama","pandas","phi3","phidata","pubmed","python","sqlalchemy","xlsx"],"created_at":"2025-03-29T18:16:27.968Z","updated_at":"2025-03-29T18:16:28.903Z","avatar_url":"https://github.com/EbodShojaei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sentinel | Terminal-Based AI Agent for PubMed Search\n\nThis application is a terminal-based AI agent that:\n\n- Accepts a natural language search query from the user.\n- Uses a local phi3.5 model (via Ollama and phidata) to generate a research purpose and a detailed MeSH search strategy.\n- Executes the search on PubMed using a free API (via Entrez from Biopython).\n- Retrieves the top 250 relevant articles, sorted by relevance and publication year.\n- Stores the search results and metadata in a relational SQL database.\n- Allows the user to export the search results and metadata to an Excel file with two tabs.\n\n## File Structure\n\n```plaintext\nsentinel/\n├── src/\n│   ├── __init__.py\n│   ├── agent.py\n│   ├── config.py\n│   └── utils/\n│       ├── __init__.py\n│       ├── xlsx_export.py\n│       ├── database.py\n│       ├── extract_values.py\n│       └── pubmed_search.py\n├── tests/\n│   ├── __init__.py\n│   └── test_pubmed_search.py\n├── main.py\n├── requirements.txt\n└── setup.sh\n```\n\n## Requirements\n\nThe application uses the following Python packages:\n\n- phidata\n- ollama\n- sqlalchemy\n- requests\n- biopython\n- openpyxl\n- pandas\n- python-dotenv\n\nSetup virtual Python environment and install all dependencies with:\n\n```bash\n./setup.sh\n```\n\n## Configuration\n\nCreate a `.env` file (make a copy of `.env.example`) in the project root with your configuration. For example:\n\n```dotenv\n# .env file\nENTREZ_EMAIL=your.email@example.com\nPUBMED_API_KEY=your_pubmed_api_key\nMODEL_ID=phi3.5\n```\n\n## Usage\n\nRun the application from the terminal:\n\n```bash\npython main.py --query \"efficacy of placebo injections in knee osteoarthritis patients between 2000 and 2025\" --export\n```\n\n- If `--query` is not provided, you will be prompted to enter it interactively.\n- Optionally specify `--min_year` and `--max_year` for the publication date range (defaults to the last 5 years).\n- The `--export` flag will export the results to an Excel file (`output.xlsx`).\n\n## Example Output\n\nSee the below example for running a custom query:\n\n```bash\npython main.py\nUsing PubMed API key for enhanced rate limits.\nEnter your search query: efficacy of placebo injections in knee osteoarthritis patients\n2025-03-28 20:58:24,835 [WARNING] No date range found in the query. Using default values: 2020 to 2025\n2025-03-28 20:58:33,472 [INFO] HTTP Request: POST http://127.0.0.1:11434/api/chat \"HTTP/1.1 200 OK\"\n2025-03-28 20:58:33,834 [INFO] HTTP Request: POST https://api.phidata.com/v1/telemetry/agent/run/create \"HTTP/1.1 200 OK\"\n2025-03-28 20:58:41,921 [INFO] HTTP Request: POST http://127.0.0.1:11434/api/chat \"HTTP/1.1 200 OK\"\n2025-03-28 20:58:42,270 [INFO] HTTP Request: POST https://api.phidata.com/v1/telemetry/agent/run/create \"HTTP/1.1 200 OK\"\n2025-03-28 20:58:42,272 [INFO] To assess whether placebo injections offer measurable improvements beyond psychological effects on physical health outcomes such as pain management and functional mobility among adults suffering from knee osteoarthritis, this study will evaluate their efficacy.\n2025-03-28 20:59:02,339 [INFO] HTTP Request: POST http://127.0.0.1:11434/api/chat \"HTTP/1.1 200 OK\"\n2025-03-28 20:59:02,680 [INFO] HTTP Request: POST https://api.phidata.com/v1/telemetry/agent/run/create \"HTTP/1.1 200 OK\"\n2025-03-28 20:59:07,426 [INFO] HTTP Request: POST http://127.0.0.1:11434/api/chat \"HTTP/1.1 200 OK\"\n2025-03-28 20:59:07,777 [INFO] HTTP Request: POST https://api.phidata.com/v1/telemetry/agent/run/create \"HTTP/1.1 200 OK\"\n2025-03-28 20:59:07,778 [INFO] (osteoarthritis knee) AND ((placebo injection treatment) AND (pain relief OR analgesia OR symptom improvement)) AND (functionality OR mobility)\n2025-03-28 20:59:07,778 [INFO] Executing PubMed search...\nFinal query for PubMed: (osteoarthritis knee) AND ((placebo injection treatment) AND (pain relief OR analgesia OR symptom improvement)) AND (functionality OR mobility) AND \"2020/01/01\"[dp] : \"2025/12/31\"[dp]\nFound 74 PubMed IDs\n2025-03-28 20:59:19,417 [INFO] Retrieved 74 search results\n2025-03-28 20:59:19,460 [INFO] Data stored successfully in the database.\n```\n\n## License\n\nThis project is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febodshojaei%2Fsentinel_ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febodshojaei%2Fsentinel_ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febodshojaei%2Fsentinel_ai/lists"}