Skip to content

Commit

Permalink
parseOSD updates and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jul 3, 2021
1 parent 6d70a71 commit 0d3bfd6
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 213 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ importFrom(rvest,html_node)
importFrom(rvest,html_nodes)
importFrom(rvest,html_text)
importFrom(stats,aggregate)
importFrom(stringi,stri_detect_fixed)
importFrom(stringi,stri_enc_toascii)
importFrom(stringi,stri_match)
importFrom(stringi,stri_match_all)
importFrom(stringi,stri_trans_general)
importFrom(tibble,as_tibble)
importFrom(tools,file_ext)
Expand Down
12 changes: 6 additions & 6 deletions R/create_OSD.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ osd_to_json <- function(logfile = file.path(output_dir, "OSD/OSD.log"),

x <- validateOSD(logfile, filepath)

typicalpedon <- .parseTypicalPedon(x[["TYPICAL PEDON"]])
parsed.OSD <- .doParseOSD(x)

# SPC-style components from parseOSD returned as nested data.frames in JSON
x$SITE <- I(list(parsed.OSD$`site-data`))
x$HORIZONS <- I(list(parsed.OSD$`hz-data`))

if (is.logical(x))
if (!x) return(FALSE)
Expand All @@ -385,14 +389,10 @@ osd_to_json <- function(logfile = file.path(output_dir, "OSD/OSD.log"),

fn <- gsub("\\.txt", "\\.json", basename(all_osds[[i]]))

write(jsonlite::toJSON(x, pretty = TRUE, auto_unbox = TRUE),
write(jsonlite::toJSON(x, pretty = TRUE, auto_unbox = FALSE),
file = file.path(fld, fn))
return(TRUE)
})
names(res) <- all_osds
return(res)
}

.parseTypicalPedon <- function(section) {

}
Loading

0 comments on commit 0d3bfd6

Please sign in to comment.