openbionews 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. openbionews-0.4.0/CHANGELOG.md +101 -0
  2. openbionews-0.4.0/CODE_OF_CONDUCT.md +44 -0
  3. openbionews-0.4.0/CONTRIBUTING.md +70 -0
  4. openbionews-0.4.0/LICENSE +21 -0
  5. openbionews-0.4.0/MANIFEST.in +9 -0
  6. openbionews-0.4.0/PKG-INFO +444 -0
  7. openbionews-0.4.0/README.md +410 -0
  8. openbionews-0.4.0/config.example.json +162 -0
  9. openbionews-0.4.0/openbionews/__init__.py +11 -0
  10. openbionews-0.4.0/openbionews/__main__.py +6 -0
  11. openbionews-0.4.0/openbionews/cite.py +86 -0
  12. openbionews-0.4.0/openbionews/cli.py +146 -0
  13. openbionews-0.4.0/openbionews/compose.py +60 -0
  14. openbionews-0.4.0/openbionews/config.py +190 -0
  15. openbionews-0.4.0/openbionews/connectors/__init__.py +51 -0
  16. openbionews-0.4.0/openbionews/connectors/base.py +30 -0
  17. openbionews-0.4.0/openbionews/connectors/clinicaltrials.py +196 -0
  18. openbionews-0.4.0/openbionews/connectors/edgar.py +145 -0
  19. openbionews-0.4.0/openbionews/connectors/openfda.py +158 -0
  20. openbionews-0.4.0/openbionews/connectors/openfda_approvals.py +190 -0
  21. openbionews-0.4.0/openbionews/connectors/openfda_shortages.py +151 -0
  22. openbionews-0.4.0/openbionews/data/demo_clinicaltrials.json +26 -0
  23. openbionews-0.4.0/openbionews/data/demo_edgar.json +27 -0
  24. openbionews-0.4.0/openbionews/data/demo_fda_approvals.json +13 -0
  25. openbionews-0.4.0/openbionews/data/demo_fda_shortages.json +14 -0
  26. openbionews-0.4.0/openbionews/data/demo_openfda.json +24 -0
  27. openbionews-0.4.0/openbionews/data/sample_feed_a.xml +36 -0
  28. openbionews-0.4.0/openbionews/data/sample_feed_b.xml +29 -0
  29. openbionews-0.4.0/openbionews/demo.py +71 -0
  30. openbionews-0.4.0/openbionews/doctor.py +81 -0
  31. openbionews-0.4.0/openbionews/fetch.py +171 -0
  32. openbionews-0.4.0/openbionews/history.py +114 -0
  33. openbionews-0.4.0/openbionews/httputil.py +60 -0
  34. openbionews-0.4.0/openbionews/llm/__init__.py +39 -0
  35. openbionews-0.4.0/openbionews/llm/_http.py +35 -0
  36. openbionews-0.4.0/openbionews/llm/base.py +84 -0
  37. openbionews-0.4.0/openbionews/llm/nollm.py +35 -0
  38. openbionews-0.4.0/openbionews/llm/ollama.py +60 -0
  39. openbionews-0.4.0/openbionews/llm/openai_compat.py +62 -0
  40. openbionews-0.4.0/openbionews/mailer.py +74 -0
  41. openbionews-0.4.0/openbionews/models.py +110 -0
  42. openbionews-0.4.0/openbionews/pipeline.py +153 -0
  43. openbionews-0.4.0/openbionews/render.py +348 -0
  44. openbionews-0.4.0/openbionews/run.py +141 -0
  45. openbionews-0.4.0/openbionews/setup_wizard.py +340 -0
  46. openbionews-0.4.0/openbionews/sources.py +259 -0
  47. openbionews-0.4.0/openbionews/termio.py +23 -0
  48. openbionews-0.4.0/openbionews/textutil.py +114 -0
  49. openbionews-0.4.0/openbionews.egg-info/PKG-INFO +444 -0
  50. openbionews-0.4.0/openbionews.egg-info/SOURCES.txt +56 -0
  51. openbionews-0.4.0/openbionews.egg-info/dependency_links.txt +1 -0
  52. openbionews-0.4.0/openbionews.egg-info/entry_points.txt +2 -0
  53. openbionews-0.4.0/openbionews.egg-info/requires.txt +6 -0
  54. openbionews-0.4.0/openbionews.egg-info/top_level.txt +1 -0
  55. openbionews-0.4.0/pyproject.toml +54 -0
  56. openbionews-0.4.0/requirements.txt +8 -0
  57. openbionews-0.4.0/setup.cfg +4 -0
  58. openbionews-0.4.0/tests/test_pipeline.py +652 -0
@@ -0,0 +1,101 @@
1
+ # Changelog
2
+
3
+ All notable changes to OpenBioNews are documented here. The format is loosely
4
+ based on [Keep a Changelog](https://keepachangelog.com/), and the project aims
5
+ to follow [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.4.0]
10
+
11
+ ### Added
12
+ - **LLM as a labelled interpretation layer** — with per-sentence citations now
13
+ the factual body, an enabled LLM (Ollama / OpenAI-compatible) no longer writes
14
+ the facts; it adds only a clearly-marked *"💡 Why it matters (AI analysis)"*
15
+ note beneath the deterministic cited claims (turn on `output.why_it_matters`).
16
+ The facts stay verbatim and cited — nothing to hallucinate — while the model
17
+ supplies interpretation you can tell apart at a glance. A failed note is dropped
18
+ with a warning; the cited body always renders. Runs across Markdown/HTML/text/RSS.
19
+ - **Change detection between runs** — OpenBioNews now remembers each item's
20
+ salient state (by NCT id, recall number, EDGAR accession) and flags what
21
+ *changed* on the next run: a trial moved to Terminated, results posted, a recall
22
+ reclassified. Changed stories are boosted in ranking and badged (`🔔 Status:
23
+ Recruiting → Terminated`). Deterministic — a literal state comparison, **no LLM**.
24
+ New `openbionews/history.py`; state lives in `digest/state.json` (configurable).
25
+ - **Thematic groups** (`sources.THEMES`) — one-tap watch-list seeds that cut
26
+ across diseases by *modality / approach / company cohort*: **AI in drug
27
+ discovery**, **New Approach Methodologies (NAM)**, gene & cell therapy, CRISPR,
28
+ mRNA, ADCs, radiopharmaceuticals, GLP-1/obesity, psychedelics, longevity. Each
29
+ seeds search terms and a lead-sponsor cohort. Wizard multi-select + web chips.
30
+ - **Stackable web filters** — chips on the hosted page now *add* to a field
31
+ instead of replacing it, and multi-value fields become a ClinicalTrials.gov
32
+ `OR` query, so you can watch several conditions / companies / themes at once.
33
+ - **Per-sentence citations** — every sentence of a story's brief is bound to the
34
+ primary-source record it was lifted from, rendered as a numbered `[n]` / `<sup>`
35
+ marker with a keyed source list beneath. Fully deterministic: the text is
36
+ verbatim from the cited record, so there is nothing to hallucinate and **no LLM
37
+ is involved**. Applies across every output (Markdown, HTML, text, RSS) and the
38
+ hosted web page. New `openbionews/cite.py`; a `Claim` model on each cluster.
39
+ - Continuous integration (GitHub Actions) running the test suite on Linux, macOS
40
+ and Windows across Python 3.9–3.12, plus an install/CLI smoke test.
41
+ - Community health files: `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, issue and pull
42
+ request templates.
43
+ - **Offline mixed demo**: `openbionews run --demo` now builds a digest from
44
+ bundled samples covering trade-press RSS *and* all three primary sources
45
+ (ClinicalTrials.gov, FDA recalls, SEC filings), each with a source citation —
46
+ a network-free preview of the real output.
47
+ - **RSS feed output** (`--format rss`, or `output.format: rss`): writes a valid
48
+ RSS 2.0 feed (`digest/latest.xml`) you can subscribe to in any reader, with a
49
+ source citation in every item. Standard-library only. (Closes #2.)
50
+ - **openFDA drug-approvals connector** (`connectors.openfda_approvals`): recent
51
+ Drugs@FDA approvals — original and supplemental (new indication) — cited to
52
+ the Drugs@FDA page. Wizard toggle, doctor check, and demo coverage included.
53
+ (Closes #1.)
54
+ - **Therapeutic-area presets** (oncology, cardiometabolic, rare disease,
55
+ neurology, immunology, infectious disease): one-tap watch-list seeding in the
56
+ setup wizard and matching chips on the hosted page. (Closes #4.)
57
+ - **openFDA drug-shortages connector** (`connectors.openfda_shortages`): current
58
+ (or resolved) shortages by drug/company, cited to the FDA Drug Shortages
59
+ database — completing the FDA trio (recalls + approvals + shortages).
60
+ - **Hosted page parity**: the web app now has five tabs — Clinical trials, FDA
61
+ recalls, **FDA approvals**, **FDA shortages**, and SEC filings — matching the
62
+ CLI's source coverage, all client-side with shareable links.
63
+
64
+ ### Fixed
65
+ - Windows: the setup wizard and `doctor` could raise `UnicodeEncodeError` when
66
+ invoked directly (bypassing the CLI entry point) because stdout defaulted to a
67
+ legacy code page. The UTF-8 guard is now shared and applied at every entry
68
+ point (`openbionews/termio.py`). Caught by the new cross-platform CI.
69
+ - De-duplication now keys on an item's stable id (NCT id, recall number, EDGAR
70
+ accession) before its link. Previously, sources whose links differ only by a
71
+ query string (e.g. openFDA recall records) could be wrongly collapsed into one.
72
+
73
+ ## [0.3.0]
74
+
75
+ ### Added
76
+ - **openFDA drug-recalls connector** — enforcement reports filtered by
77
+ firm/product/reason, classification and report-date recency; cites the FDA
78
+ record.
79
+ - **SEC EDGAR connector** — full-text search of filings by company/drug/term,
80
+ form type and filed-within recency; cites the filing document and sets the
81
+ contact `User-Agent` SEC requires. Runs server-side, avoiding browser CORS.
82
+ - Hosted web page gained an **SEC filings tab** (with a graceful fallback to
83
+ SEC's own EDGAR search when a browser blocks the request) and an **FDA drug
84
+ recalls tab**, plus shareable filter links.
85
+ - Useful filters based on how biopharma teams monitor: trial recency +
86
+ industry-sponsored-only; recall report-date recency + voluntary/mandated.
87
+
88
+ ## [0.2.0]
89
+
90
+ ### Added
91
+ - **Primary-source model**: `connectors/` package and a **ClinicalTrials.gov**
92
+ connector with a shared watch list and per-story source citations.
93
+ - Hosted, zero-install web page (`docs/`) for filtering ClinicalTrials.gov.
94
+
95
+ ## [0.1.0]
96
+
97
+ ### Added
98
+ - Initial release: RSS/Atom digest with cross-outlet de-dup, importance ranking
99
+ and read-time; no-LLM / Ollama / OpenAI-compatible summaries; optional SMTP
100
+ email; onboarding wizard; `doctor` diagnostics; Markdown/HTML/text output.
101
+ Pure standard library, cross-platform, MIT-licensed.
@@ -0,0 +1,44 @@
1
+ # Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in
6
+ OpenBioNews a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+
16
+ - Being respectful of differing opinions, viewpoints, and experiences
17
+ - Giving and gracefully accepting constructive feedback
18
+ - Focusing on what is best for the community
19
+ - Showing empathy toward other people
20
+
21
+ Examples of unacceptable behavior:
22
+
23
+ - Harassment, insults, or derogatory comments, and personal or political attacks
24
+ - Public or private harassment
25
+ - Publishing others' private information without explicit permission
26
+ - Other conduct which could reasonably be considered inappropriate in a
27
+ professional setting
28
+
29
+ ## Enforcement
30
+
31
+ Maintainers are responsible for clarifying and enforcing these standards and
32
+ will take appropriate and fair corrective action in response to any behavior
33
+ they deem inappropriate, threatening, offensive, or harmful.
34
+
35
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
36
+ reported by opening a confidential issue or contacting a maintainer. All
37
+ complaints will be reviewed and investigated promptly and fairly.
38
+
39
+ ## Attribution
40
+
41
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
42
+ version 2.1.
43
+
44
+ [homepage]: https://www.contributor-covenant.org
@@ -0,0 +1,70 @@
1
+ # Contributing to OpenBioNews
2
+
3
+ Thanks for helping build a free, self-hosted news tool. Contributions of every
4
+ size are welcome — a typo fix, a new feed, a whole new connector.
5
+
6
+ ## Ground rules
7
+
8
+ - **Zero required dependencies.** The core runs on the Python standard library
9
+ (3.9+). Don't add a runtime dependency without discussion; optional extras go
10
+ under `[project.optional-dependencies]`.
11
+ - **Privacy first.** The tool must never phone home. No telemetry, no analytics.
12
+ - **Everything works offline where it can.** Failures degrade gracefully — a
13
+ dead feed is skipped, a failed LLM call falls back to no-LLM.
14
+
15
+ ## Getting started
16
+
17
+ ```bash
18
+ git clone https://github.com/fedor-i/OpenBioNews.git
19
+ cd OpenBioNews
20
+ python3 -m openbionews run --demo # works offline, no install
21
+ pip install . # optional: install the CLI
22
+ ```
23
+
24
+ ## Running the tests
25
+
26
+ The suite uses only the standard library, so no install is needed:
27
+
28
+ ```bash
29
+ python3 tests/test_pipeline.py # prints ok/FAIL per test
30
+ # or, if you have pytest:
31
+ pytest
32
+ ```
33
+
34
+ CI runs these on Linux, macOS and Windows across Python 3.9–3.12. Please make
35
+ sure `python3 tests/test_pipeline.py` passes before opening a PR.
36
+
37
+ ## Adding a primary-source connector
38
+
39
+ Connectors are the highest-value contributions. See
40
+ [`ARCHITECTURE.md`](ARCHITECTURE.md) → *Adding a primary-source connector*. In
41
+ short:
42
+
43
+ 1. Add `openbionews/connectors/<name>.py` with a class extending
44
+ `connectors.base.Connector`, a `fetch()` and an `available()`.
45
+ 2. **Split parsing from fetching** (a `parse_*` function) so it can be tested
46
+ with a fixture and no network.
47
+ 3. Attach a `Citation` to every `Item` and set `age_exempt=True`.
48
+ 4. Register it in `connectors/__init__.py`, add a config block in `config.py`,
49
+ and a step in `setup_wizard.py`.
50
+ 5. Add fixture-based tests.
51
+
52
+ ## Adding feeds
53
+
54
+ Edit the bundles in `openbionews/sources.py`. Prefer official or well-known
55
+ RSS/Atom feeds, and run `openbionews doctor` to confirm the URL resolves.
56
+
57
+ ## Style
58
+
59
+ - Match the surrounding code; keep functions small and documented.
60
+ - Prefer clarity over cleverness. Comment *why*, not *what*.
61
+ - Keep user-facing text plain and active-voice.
62
+
63
+ ## Pull requests
64
+
65
+ - One focused change per PR.
66
+ - Update `CHANGELOG.md` under "Unreleased".
67
+ - Describe what changed and how you tested it.
68
+
69
+ By contributing, you agree your work is licensed under the project's
70
+ [MIT License](LICENSE).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenBioNews contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include CONTRIBUTING.md
5
+ include CODE_OF_CONDUCT.md
6
+ include config.example.json
7
+ include requirements.txt
8
+ recursive-include openbionews/data *.xml *.json
9
+ recursive-include tests *.py