fix: resolve composite event columns via faers_get, support all MedDRA hierarchy levels - #29
Merged
Merged
Conversation
Contributor
|
@MadDERt 如果是ai工作生成的,确认代码你都自己阅读过,然后check过了你自己可以直接合并。 后面的pr都这样的标准处理 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
faers_phv_composite()/faers_phv_signal_composite()were broken forMedDRA hierarchy event types and bypassed the duckdb backend. This PR fixes
the event-column resolution and hardens the input validation.
The core fix:
.identify_event_set_patients()now resolves event columnsvia
faers_get(object, "reac"), which attaches the MedDRA hierarchy columnson both the memory and the duckdb backends — the same resolution path used
by
faers_counts()andfaers_phv_scan().Problems fixed
.event_type = "soc_name"abortedwith
object 'soc_name' not foundon both backends, because the rawreactable lacks hierarchy columns. Now works for any standardizedreaccolumn (pt,meddra_code,meddra_pt, and all MedDRA hierarchycolumns such as
soc_name/hlgt_name), with a helpful error messagelisting the available columns.
db_collect(con, "reac")pulled thewhole table into memory; removed in favor of
faers_get()..fullobjects — an unusedfaers_counts()call went throughcounts_db()and failed with a SQLbinder error; removed.
faers_dedup()required), consistentwith
faers_phv_scan().assertthatusage replaced with the internalassert_()helper (same style as scan).
setnames()line was removed.Testing
tests/testthat/test_signal-eventset.R(the file did not exist):26 assertions — soc_name/hlgt_name regression, character & function
event sets, 2×2 conservation,
.object2comparison mode, thede-duplication guard, and memory ↔ duckdb
identical()paritytest_meta.Rnetwork/cache environment items (unchanged baseline)R CMD check: no new issues introducedNotes
faers_phv_scan()); rawptmode output is otherwise unchanged.fullcomposite callsfilter in-database instead of materializing the table