-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* define SIC data structure * add SIC to auto attach * add SIC loading helpers * add callback hooks to postprocess tbls on import * add callback to deserialise sicdb data_float_h * add missing tbl_callback function * add sic_itm inspired by hrd_itm * adjust data_float_h config to recent changes * add hr and crea as examples for sicdb * add sex and death concepts for sic * add vitals, labs, height, and weight concepts for sic * add age and los_icu concepts * add most medication concepts for sic * fix preproc for data_float_h some values are only taken once during the hour and thus have a cnt=1 and rawdata=NA. The actual data is stored in Val, which otherwise holds the average. Since after expansion, rawdata is the main data field, the value from Val needs to be moved to rawdata in this case. * add OMR to miiv * add miiv omr * load_concepts() concepts arg doc fix * load_concepts.integer() src NULL fix * Fix sic config * Properly support full rawdata found in sic * Remove print * Add utility functions proposed by `prockenschaub` here: https://github.com/eth-mds/ricu/pull/30/files * Fix configs for `sic` based on `prockenschaub` * Fix `sic` configs based on https://github.com/prockenschaub/ricu-package/tree/sicdb * Remove prints and use ricu msg * Remove redundant `report_probolems` * Add prints and tempdir arg * Cleanup prints * Fix blood_gas config * Fix sic table config * Use finer resolution rawdata where available * Pass tbl callback correctly * Fix missing callback application * Apply callback before split_write * Config updates: - Fix sic bugs - Slack temp range * Fix configs * Fix callback * Use `apply_map` for `sic` `sex` --------- Co-authored-by: prockenschaub <rockenschaub.patrick@gmail.com> Co-authored-by: Drago <www.plecko@gmail.com>
- Loading branch information
1 parent
7824352
commit 887f22b
Showing
20 changed files
with
632 additions
and
433 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
sic_data_float_h <- function(dat, ...) { | ||
|
||
hexstring_to_float <- function(x) { | ||
if (is.na(x)) { | ||
return(NA_real_) | ||
} | ||
hexstring <- substring(x, seq(1, 482, 2), seq(2, 482, 2)) | ||
bytes <- as.raw(strtoi(hexstring[-1], base = 16)) | ||
floats <- readBin(bytes, numeric(), length(bytes) %/% 4, 4, endian = "little") | ||
ifelse(floats == 0, NA_real_, floats) | ||
} | ||
|
||
setDT(dat) | ||
|
||
# TODO: remove hard coding of rawdata and derive from JSON config | ||
dat[, c("rawdata") := lapply(get("rawdata"), hexstring_to_float)] | ||
dat <- dat[, .( | ||
Offset = Offset + 60 * (0:(sapply(rawdata, length)-1)), | ||
Val = Val, | ||
cnt = cnt, | ||
rawdata = unlist(rawdata), | ||
rawdata_present = !is.na(rawdata) | ||
), | ||
by = .(id, CaseID, DataID) | ||
] | ||
|
||
# Fix measurements that only have one value | ||
dat[rawdata_present == FALSE, rawdata := Val] | ||
dat[, rawdata_present := NULL] | ||
|
||
return(dat) | ||
|
||
} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.