Skip to content

Commit

Permalink
Add additional features for common validation options (#149)
Browse files Browse the repository at this point in the history
* WIP presets dropdown

* WIP ips au preset

* Rename extension, ig, and profile state

* Add update code for extensions

* Add profiles to presets, add all required presets

* Make pretty

* Check IPS codes, add bundle validation rules to presets

* Use i18n for presets

* Add options checkbox for IPS codes

* Rename re-used extension display

* WIP add bundle validation rule widget, fix some session id update logic

* Layout tweaks

* Adjust font

* Add help text for bundle validation, layout improvements

* Refactor file upload buttons

* Add preset widget to upload page

* Adjust preset widget layout and description
  • Loading branch information
dotasek authored Nov 1, 2023
1 parent bced12c commit bad7406
Show file tree
Hide file tree
Showing 34 changed files with 1,263 additions and 251 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ kotlin.code.style=official
kotlin.js.generate.executable.default=false

# versions
fhirCoreVersion=6.1.12
fhirCoreVersion=6.2.1

junitVersion=5.7.1
mockk_version=1.10.2
Expand Down
3 changes: 3 additions & 0 deletions src/commonMain/kotlin/constants/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package constants

const val ANY_EXTENSION = "any"
9 changes: 9 additions & 0 deletions src/commonMain/kotlin/model/BundleValidationRule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package model

expect class BundleValidationRule() {
fun getRule(): String
fun setRule(rule: String): BundleValidationRule

fun getProfile(): String
fun setProfile(profile: String): BundleValidationRule
}
8 changes: 8 additions & 0 deletions src/commonMain/kotlin/model/CliContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ expect class CliContext() {
fun setExtensions(extensions: List<String>) : CliContext

fun getExtensions() : List<String>

fun setCheckIPSCodes(checkIPSCodes : Boolean) : CliContext

fun isCheckIPSCodes() : Boolean

fun setBundleValidationRules(bundleValidationRules: List<BundleValidationRule>) : CliContext

fun getBundleValidationRules():List<BundleValidationRule>
}
24 changes: 23 additions & 1 deletion src/commonMain/resources/static-content/polyglot/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"options_flags_binding_warnings_description" : "Wenn der Validator auf einen Code stößt, der nicht Teil eines extensible Bindings ist, fügt er eine Warnung hinzu, um vorzuschlagen, dass der Code überprüft werden sollte. Der Validator kann nicht feststellen, ob die Bedeutung des Codes ihn zu einer unangemessenen Erweiterung macht oder nicht; dies erfordert eine menschliche Überprüfung. Daher auch die Warnung. Aber der Code kann gültig sein - deshalb ist extensible definiert - also ist es in einigen Anwendungen des Validators angebracht, diese Warnungen auszuschalten.",
"options_flags_show_times_title" : "Show Times (showTimes)",
"options_flags_show_times_description" : "Wenn Sie diese Option wählen, gibt der Validator in der Ausgabe eine Zeile aus, in der er zusammenfasst, wie lange einige interne Prozesse gedauert haben.",
"options_flags_allow_example_title" : "Erlaube Beispiel URLs (allow-example-urls)",
"options_flags_allow_example_title" : "Erlaube Beispiel URLs (-allow-example-urls)",
"options_flags_allow_example_description" : "Einige der Beispiele in der FHIR-Spezifikation enthalten URLs, die auf example.org verweisen. Standardmäßig markiert der Validator solche Verweise immer als Fehler, aber dies kann mit diesem Parameter überschrieben werden.",
"options_flags_check_ips_codes_title" : "Check IPS Codes (-check-ips-codes) -German",
"options_flags_check_ips_codes_description" : "When selected, the validator will report a list of SNOMED CT codes used by the source(s) being validated that are not part of the SNOMED CT IPS free set (as hints). -German",
"options_fhir_title" : "FHIR version",
"options_default_label" : "Version",
"options_fhir_description" : "Der Validator prüft die Ressource anhand der Basisspezifikation. Standardmäßig ist dies die Spezifikation Version 4.0.1.",
Expand All @@ -53,6 +55,17 @@
"options_profiles_description" : "The canonical URLs for the profiles you wish to validate against. These are usually clearly specified on the page where the profile is published.-German",
"options_profiles_not_added" : "Added Profiles (%{addedProfiles})-German",
"options_profiles_added" : "Added Profiles (%{addedProfiles}):-German",
"options_bundle_validation_rules_title" : "Bundle Validation-German",
"options_bundle_validation_rules_description" : "The validator can validate a particular resource in the bundle against a given profile. This is separate fro m the '-profile' option, which is the profile for the bundle itself. Each entry consists of a rule definition and a profile. The rule is defined as a resource name, an integer index, or both. Rule examples:-German",
"options_bundle_validation_rules_example_1" : "Patient - validate any patient against the nominated profile-German",
"options_bundle_validation_rules_example_2" : "0 - validate the first resource (index is 0 based) against the nominated profile-German",
"options_bundle_validation_rules_example_3" : "Patient:0 - validate the first patient resource against the nominated profile-German",
"options_bundle_validation_rules_not_added" : "Added Rules (%{addedProfiles})-German",
"options_bundle_validation_rules_added" : "Added Rules (%{addedProfiles}):-German",
"options_bundle_validation_rules_rule_label" : "Rule-German",
"options_bundle_validation_rules_rule_description" : "A Resource name, an integer index, or both.-German",
"options_bundle_validation_rules_profile_label" : "Profile-German",
"options_bundle_validation_rules_profile_description" : "The nominated profile, by canonical URL-German",
"options_settings_title" : "Sonstige Einstellungen",
"options_settings_snomed_title" : "Wählen Sie die SNOMED Version aus",
"options_settings_snomed_description" : "Sie können angeben, welche Ausgabe von SNOMED CT der Terminologieserver bei der SNOMED CT-Validierung verwenden soll.",
Expand All @@ -72,5 +85,14 @@
"validation_errors" : "Fehler",
"validation_warnings" : "Warnungen",
"validation_info" : "Information",
"preset_label" : "Common Validation Options... -German",
"preset_description" : "Click to automatically set options for common validation tasks-German",
"preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings. -German",
"preset_fhir_resource" : "FHIR Resource -German",
"preset_ips" : "IPS Document -German",
"preset_ips_au" : "Australian IPS Document -German",
"present_cda" : "CDA Document -German",
"preset_us_ccda" : "US CCDA Document -German",
"preset_sql_view": "SQL View Definition -German",
"language" : "Sprache"
}
24 changes: 23 additions & 1 deletion src/commonMain/resources/static-content/polyglot/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"options_flags_binding_warnings_description" : "When the validator encounters a code that is not part of an extensible binding, it adds a warning to suggest that the code be reviewed. The validator can't determine whether the meaning of the code makes it an inappropriate extension, or not; this requires human review. Hence, the warning. But the code may be valid - that's why extensible is defined - so in some operational uses of the validator, it is appropriate to turn these warnings off",
"options_flags_show_times_title" : "Show Times (-show-times)",
"options_flags_show_times_description" : "When selected the validator will produce a line in the output summarizing how long some internal processes took.",
"options_flags_allow_example_title" : "Allow Example URLs (allow-example-urls)",
"options_flags_allow_example_title" : "Allow Example URLs (-allow-example-urls)",
"options_flags_allow_example_description" : "Some of the examples in the FHIR specification have URLs in them that refer to example.org. By default, the validator will always mark any such references as an error, but this can be overridden with this parameter.",
"options_flags_check_ips_codes_title" : "Check IPS Codes (-check-ips-codes)",
"options_flags_check_ips_codes_description" : "When selected, the validator will report a list of SNOMED CT codes used by the source(s) being validated that are not part of the SNOMED CT IPS free set (as hints).",
"options_fhir_title" : "FHIR version",
"options_default_label" : "Version",
"options_fhir_description" : "The validator checks the resource against the base specification. By default, this is specification version 4.0.1.",
Expand All @@ -53,6 +55,17 @@
"options_profiles_description" : "The canonical URLs for the profiles you wish to validate against. These are usually clearly specified on the page where the profile is published.",
"options_profiles_not_added" : "Added Profiles (%{addedProfiles})",
"options_profiles_added" : "Added Profiles (%{addedProfiles}):",
"options_bundle_validation_rules_title" : "Bundle Validation",
"options_bundle_validation_rules_description" : "The validator can validate a particular resource in the bundle against a given profile. This is separate from the '-profile' option, which is the profile for the bundle itself. Each entry consists of a rule definition and a profile. The rule is defined as a resource name, an integer index, or both. Rule examples:",
"options_bundle_validation_rules_example_1" : "Patient - validate any patient against the nominated profile",
"options_bundle_validation_rules_example_2" : "0 - validate the first resource (index is 0 based) against the nominated profile",
"options_bundle_validation_rules_example_3" : "Patient:0 - validate the first patient resource against the nominated profile",
"options_bundle_validation_rules_not_added" : "Added Rules (%{addedProfiles})",
"options_bundle_validation_rules_added" : "Added Rules (%{addedProfiles}):",
"options_bundle_validation_rules_rule_label" : "Rule",
"options_bundle_validation_rules_rule_description" : "A Resource name, an integer index, or both.",
"options_bundle_validation_rules_profile_label" : "Profile",
"options_bundle_validation_rules_profile_description" : "The nominated profile, by canonical URL",
"options_settings_title" : "Other Settings",
"options_settings_snomed_title" : "Select SNOMED Version",
"options_settings_snomed_description" : "You can specify which edition of SNOMED CT for the terminology server to use when doing SNOMED CT Validation.",
Expand All @@ -72,5 +85,14 @@
"validation_errors" : "Errors",
"validation_warnings" : "Warnings",
"validation_info" : "Information",
"preset_label" : "Common Validation Options...",
"preset_description" : "Click to automatically set options for common validation tasks",
"preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings.",
"preset_fhir_resource" : "FHIR Resource",
"preset_ips" : "IPS Document",
"preset_ips_au" : "Australian IPS Document",
"present_cda" : "CDA Document",
"preset_us_ccda" : "US CCDA Document",
"preset_sql_view": "SQL View Definition",
"language" : "Language"
}
24 changes: 23 additions & 1 deletion src/commonMain/resources/static-content/polyglot/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
"options_flags_binding_warnings_description": "Cuando el validador encuentra un código que no es parte de una vinculacíon terminológica extensible, agrega una alerta para sugerir que el código sea revisado. El validador no puede determinar si el significado del código genera una extensión inapropiada o no; esto requiere revisión manual. De allí proviene la alerta - Pero el código puede ser válido - para eso se define como extensible - asi que en algunos usos operacionales del validador, es correcto apagar algunos de estas alertas",
"options_flags_show_times_title": "Mostrar Tiempos (-show-times)",
"options_flags_show_times_description": "Cuando se selecciona esta opción el validador generará una linea en la salida resumiendo cuanto tiempo demoran los procesos internos",
"options_flags_allow_example_title": "Permitir URLs de ejemplo (allow-example-urls)",
"options_flags_allow_example_title": "Permitir URLs de ejemplo (-allow-example-urls)",
"options_flags_allow_example_description": "Alguno de los ejemplos en la especificación FHIR tienen URLs que apuntan a example.org. Por omisión, el validador las marcará como un error pero esta conducta puede ser modificado a través de este parámetro",
"options_flags_check_ips_codes_title" : "Check IPS Codes (-check-ips-codes) -Spanish",
"options_flags_check_ips_codes_description" : "When selected, the validator will report a list of SNOMED CT codes used by the source(s) being validated that are not part of the SNOMED CT IPS free set (as hints). -Spanish",
"options_fhir_title": "Versión de FHIR",
"options_default_label": "Version",
"options_fhir_description": "El validador verifica el recurso contra la especificación base. Por omisión, esta es la especificación versión 4.0.1",
Expand All @@ -54,6 +56,17 @@
"options_profiles_description" : "The canonical URLs for the profiles you wish to validate against. These are usually clearly specified on the page where the profile is published.-Spanish",
"options_profiles_not_added" : "Added Profiles (%{addedProfiles})-Spanish",
"options_profiles_added" : "Added Profiles (%{addedProfiles}):-Spanish",
"options_bundle_validation_rules_title" : "Bundle Validation-Spanish",
"options_bundle_validation_rules_description" : "The validator can validate a particular resource in the bundle against a given profile. This is separate fro m the '-profile' option, which is the profile for the bundle itself. Each entry consists of a rule definition and a profile. The rule is defined as a resource name, an integer index, or both. Rule examples:-Spanish",
"options_bundle_validation_rules_example_1" : "Patient - validate any patient against the nominated profile-Spanish",
"options_bundle_validation_rules_example_2" : "0 - validate the first resource (index is 0 based) against the nominated profile-Spanish",
"options_bundle_validation_rules_example_3" : "Patient:0 - validate the first patient resource against the nominated profile-Spanish",
"options_bundle_validation_rules_not_added" : "Added Rules (%{addedProfiles})-Spanish",
"options_bundle_validation_rules_added" : "Added Rules (%{addedProfiles}):-Spanish",
"options_bundle_validation_rules_rule_label" : "Rule-Spanish",
"options_bundle_validation_rules_rule_description" : "A Resource name, an integer index, or both.-Spanish",
"options_bundle_validation_rules_profile_label" : "Profile-Spanish",
"options_bundle_validation_rules_profile_description" : "The nominated profile, by canonical URL-Spanish",
"options_settings_snomed_title": "Elegir versión de SNOMED",
"options_settings_snomed_description": "Puede especificar qué edición de SNOMED CT utilizará para el servidor terminológico cuando valida SNOMED CT",
"options_settings_tm_title": "Definir Servidor de Terminología",
Expand All @@ -72,5 +85,14 @@
"validation_errors": "Errores",
"validation_warnings": "Alertas",
"validation_info": "Información",
"preset_label" : "Common Validation Options... -Spanish",
"preset_description" : "Click to automatically set options for common validation tasks-Spanish",
"preset_notification" : "Set to validate using %{selectedPreset}. Select the Options tab for more settings. -Spanish",
"preset_fhir_resource" : "FHIR Resource -Spanish",
"preset_ips" : "IPS Document -Spanish",
"preset_ips_au" : "Australian IPS Document -Spanish",
"present_cda" : "CDA Document -Spanish",
"preset_us_ccda" : "US CCDA Document -Spanish",
"preset_sql_view": "SQL View Definition -Spanish",
"language": "Lenguaje"
}
4 changes: 2 additions & 2 deletions src/jsMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ui.components.tabs.tabLayout
import kotlinx.browser.window
import model.CliContext
import utils.Language
import utils.getSelectedLanguage


external interface AppProps : Props {
var appScreen: AppScreen
Expand All @@ -32,7 +32,7 @@ val mainScope = MainScope()
fun languageSetup(props: AppProps) {
for (item in window.navigator.languages) {
val prefix = item.substring(0, 2)
var selectedLanguage = getSelectedLanguage(prefix)
var selectedLanguage = Language.getSelectedLanguage(prefix)
if (selectedLanguage != null) {
props.setLanguage(selectedLanguage)
props.fetchPolyglot(selectedLanguage.getLanguageCode());
Expand Down
15 changes: 9 additions & 6 deletions src/jsMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import css.GlobalStyles
import kotlinx.browser.document
import react.create
import react.dom.client.createRoot

import react.dom.render
import react.redux.Provider
import react.redux.provider
import reactredux.containers.app
import reactredux.store.createStore
import reactredux.store.myStore

fun main() {
Expand All @@ -15,11 +19,10 @@ fun main() {
* This is where we dynamically add all generated ui elements.
*/

val rootDiv = document.getElementById("root")!!
render(rootDiv){
provider(myStore) {
app { }
}
}
val container = document.getElementById("root")!!
createRoot(container).render(Provider.create { // this: {ChildrenBuilder & Props & ProviderProps}
store = myStore // Set the store. Because it is named ProviderProps.store, you can't use name 'store' for your store any more.
app {}
})

}
57 changes: 57 additions & 0 deletions src/jsMain/kotlin/model/BundleValidationRule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package model

import kotlinx.js.Object
import kotlinx.serialization.Serializable
import utils.Preset

@Serializable
actual class BundleValidationRule actual constructor() {

private var rule: String = ""
private var profile: String = ""

actual fun getRule(): String {
return rule
}

actual fun setRule(rule: String): BundleValidationRule {
this.rule = rule
return this
}

actual fun getProfile(): String {
return profile
}

actual fun setProfile(profile: String): BundleValidationRule {
this.profile = profile
return this
}

override fun hashCode(): Int {
return toDisplayString(this).hashCode()
}

override fun equals(other: Any?): Boolean {
if (other !is BundleValidationRule) {
return false
} else {
return rule.equals(other.getRule()) && profile.equals(other.getProfile())
}
}

companion object {
fun toDisplayString(rule:BundleValidationRule): String {
return "${rule.rule} ${rule.profile}"
}

fun findByDisplayString(displayString : String, collection : Collection<BundleValidationRule>) : BundleValidationRule? {
for (rule in collection) {
if (displayString == toDisplayString(rule)) {
return rule
}
}
return null
}
}
}
24 changes: 23 additions & 1 deletion src/jsMain/kotlin/model/CliContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ actual class CliContext actual constructor() {
private var igs: List<String> = listOf()
private var profiles: List<String> = listOf()

private var checkIPSCodes = false

private var bundleValidationRules : List<BundleValidationRule> = listOf()

private var locale: String = ""
init {
sv = "4.0.1"
locale = "de"
locale = "en"
}

actual fun isDoNative(): Boolean {
Expand Down Expand Up @@ -215,4 +219,22 @@ actual class CliContext actual constructor() {
actual fun getExtensions() : List<String> {
return this.extensions
}

actual fun setCheckIPSCodes(checkIPSCodes: Boolean): CliContext {
this.checkIPSCodes = checkIPSCodes;
return this;
}

actual fun isCheckIPSCodes(): Boolean {
return this.checkIPSCodes
}

actual fun getBundleValidationRules(): List<BundleValidationRule> {
return bundleValidationRules
}

actual fun setBundleValidationRules(bundleValidationRules: List<BundleValidationRule>): CliContext {
this.bundleValidationRules = bundleValidationRules
return this
}
}
Loading

0 comments on commit bad7406

Please sign in to comment.