Bulk FHIR DataLoader
Hello, Is there an equivelant to HS.FHIRServer.Tools.DataLoader.SubmitResourceFiles for bulk fhir data (.ndjson) that exists to import from a local directory in I4H ?
Product version: IRIS 2022.3
$ZV: 2023.1.1.303
Discussion (1)0
Comments
I think it would be easier to write ndjson->json converter. Something like this:
ClassMethod nd2json(file, dir)
{
set dir = ##class(%File).NormalizeDirectory(dir)
quit:'##class(%File).Exists(file) $$$ERROR($$$GeneralError, "File " _ file _ " does not exist")
if '##class(%File).DirectoryExists(dir) {
do##class(%File).CreateDirectoryChain(dir)
quit:'##class(%File).DirectoryExists(dir) $$$ERROR($$$GeneralError, "Directory " _ dir _ " does not exist and creation failed")
}
set stream = ##class(%Stream.FileCharacter).%New()
do stream.LinkToFile(file)
while 'stream.AtEnd {
set json = stream.ReadLine($$$MaxStringLength)
//set out = ##class(%File).TempFilename("json", dir) // random orderset out = dir _ $tr($j($i(count), 4), " ", 0) _ ".json"// if the order is importantset outStream = ##class(%Stream.FileCharacter).%New()
do outStream.LinkToFile(out)
do outStream.Write(json)
do outStream.%Save()
kill outStream
}
}For future reference, it does, as of 2023.2
See https://docs.intersystems.com/irisforhealthlatest/csp/docbook/DocBook.U…