Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add batch uploader #8

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Fhir_Kotlin/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 36 additions & 23 deletions Fhir_Kotlin/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package com.sevenreup.fhir.cli
object Constants {
const val rootDescription = "The root of the project where the fhir.compiler.json file is located"
const val watchDescription = "Watch for file changes"
const val server = "Hapi fhir sever base url";
}
30 changes: 28 additions & 2 deletions Fhir_Kotlin/cli/src/main/kotlin/com/sevenreup/fhir/cli/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import com.sevenreup.fhir.cli.commands.runTests
import com.sevenreup.fhir.core.compiler.ResourceParser
import com.sevenreup.fhir.core.config.ProjectConfigManager
import com.sevenreup.fhir.core.parseBundle
import com.sevenreup.fhir.core.uploader.FileUploader
import com.sevenreup.fhir.core.utils.formatStructureMap
import com.sevenreup.fhir.core.utils.verifyQuestionnaire
import kotlinx.coroutines.runBlocking
import picocli.CommandLine
import picocli.CommandLine.*
import java.util.concurrent.Callable
Expand Down Expand Up @@ -47,6 +49,28 @@ class TestCommand : Callable<Int> {
}
}

@Command(name = "upload")
class UploaderCommand : Callable<Int> {
@Parameters(index = "0", description = ["Path to the test file"])
lateinit var path: String

@Option(names = ["-r", "--root"], description = [Constants.rootDescription])
lateinit var projectRoot: String

@Option(names = ["-s", "--server"], description = [Constants.server])
lateinit var fhirServerUrl: String

@Option(names = ["-t", "--apiKey"], description = [Constants.rootDescription])
lateinit var fhirServerUrlApiKey: String

override fun call(): Int {
runBlocking {
FileUploader(fhirServerUrl, fhirServerUrlApiKey).batchUpload(path, projectRoot)
}
return 0
}
}

@Command(name = "qst_verify")
class QuestVerifyCommand : Callable<Int> {
@Parameters(index = "0", description = ["Path to the questionnaire"])
Expand Down Expand Up @@ -105,8 +129,10 @@ class TransFormBatchCommand : Callable<Int> {
}

@Command(
subcommands = [TestCommand::class, CompileCommand::class, TransformCommand::class,
TransFormBatchCommand::class, QuestVerifyCommand::class, FmtStrCommand::class,]
subcommands = [
TestCommand::class, CompileCommand::class, TransformCommand::class,
TransFormBatchCommand::class, QuestVerifyCommand::class, FmtStrCommand::class,
UploaderCommand::class]
)
class RunCommand : Callable<Int> {
override fun call(): Int {
Expand Down
Loading
Loading