diff --git a/.gitignore b/.gitignore index 9b7a095..c8f3316 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .DS_Store -fhircore-tooling.iml -target -.idea +efsity/fhircore-tooling.iml +efsity/target +efsity/.idea diff --git a/README.md b/README.md index ce72184..f9347fe 100644 --- a/README.md +++ b/README.md @@ -1,80 +1,6 @@ # fhircore-tooling -A command line utility to support FHIRCore content authoring. This tool supports the HL7 FHIR R4 spec. +A repo to hold our FHIR content and configuration creation tools and scripts. -## How to use it - -Download the latest release from https://github.com/opensrp/fhircore-tooling/releases - -To run it as a java jar by using the command `java -jar efsity-2.1.0.jar -h` . This is the help command and will list the available options. - -If you are using a linux environment e.g. bash you can choose to create an _alias_ for this as shown below. _(Remember to reload the terminal)_ - -`alias fct='java -jar ~/Downloads/efsity-2.1.0.jar'` - -To run the previous help command you can then run `fct -h` in your terminal. - -The rest of the documentation will assume you have configured an _alias_ for running the efsity jar with alias name `fct` as above. - -### Converting structure map .txt to .json -To convert your `structure-map.txt` file to its corresponding `.json` file, you can run the command -```console -$ fct convert -t sm --input ~/Workspace/fhir-resources/coda/structure_map/coda-child-structure-map.txt -``` - -### Converting library .cql to .json -To covert a `library.cql` file to a `library.cql.fhir.json` file you can run the command -```console -$ fct convert -t cql -i /some/path/Patient-1.0.0.cql -``` - -**Options** -``` --t or --type - the type of conversion, can be sm for structure map to json or cql for cql to json library --i or --input - the input file or file path --o or --output - the output path, can be a file or directory. Optional - default is current directory -``` - -### Extracting resources from questionnaire response -To extract FHIR Resources you can run the command: -```console -$ fct extract -qr /patient-registration-questionnaire/questionnaire-response.json -sm /path/to/patient-registration-questionnaire/structure-map.txt -``` - -**Options** -``` --qr or --questionnaire-response - the questionnaire response json file --sm or --structure-map - the path to the structure map file --o or --output - the output path, can be a file or directory. Optional - default is current directory -``` - -### Validating your app configurations -The tool supports some validations for the FHIRCore app configurations. To validate you can run the command: -```console -$ fct validate -c ~/path/to/composition_config_file.json -i ~/Workspace/fhir-resources//app_configs/ -``` -The above will output a list of errors and warnings based on any configuration rules that have been violated. - -**Options** -``` --c or --composition - the composition json file of the project --i or --input - the input directory path. This should point to the folder with the app configurations e.g. ~/Workspace/fhir-resources/ecbis_cha_preview/ --o or --output - the output path, can be a file or directory. Optional - default is current directory --sm or --structure-maps - (Optional) the directory path to the location of structure map .txt or .map files. Must be a directory. Must be used with the -q flag --q or --questionnaires - (Optional) the directory path to the location of questionnaires .json files. Must be a directory. Must be used with the -sm flag -``` - -**Note:** To include _Questionnaire_ and _Structure Map_ validation add the `-sm` and `-q` flags - -**Sample screenshot output** -
-Screenshot 2023-03-27 at 21 43 09 - -## Development -### Set up -This is a Java + Kotlin maven project. You can import it in you JetBrains IntelliJ IDE as such. The utility is built on the very awesome `Picocli` library found here https://picocli.info/. - -### Building -To build and create a new jar file run the maven package command - -`mvn spotless:apply package` +- [efsity](https://github.com/onaio/fhircore-tooling/efsity) +- [importer](https://github.com/onaio/fhircore-tooling/importer) diff --git a/efsity/README.md b/efsity/README.md new file mode 100644 index 0000000..53e8ba2 --- /dev/null +++ b/efsity/README.md @@ -0,0 +1,79 @@ +# efsity +A command line utility to support FHIRCore content authoring. This tool supports the HL7 FHIR R4 spec. + +## How to use it + +Download the latest release from https://github.com/opensrp/fhircore-tooling/releases + +To run it as a java jar by using the command `java -jar efsity-2.1.0.jar -h` . This is the help command and will list the available options. + +If you are using a linux environment e.g. bash you can choose to create an _alias_ for this as shown below. _(Remember to reload the terminal)_ + +`alias fct='java -jar ~/Downloads/efsity-2.1.0.jar'` + +To run the previous help command you can then run `fct -h` in your terminal. + +The rest of the documentation will assume you have configured an _alias_ for running the efsity jar with alias name `fct` as above. + +### Converting structure map .txt to .json +To convert your `structure-map.txt` file to its corresponding `.json` file, you can run the command +```console +$ fct convert -t sm --input ~/Workspace/fhir-resources/coda/structure_map/coda-child-structure-map.txt +``` + +### Converting library .cql to .json +To covert a `library.cql` file to a `library.cql.fhir.json` file you can run the command +```console +$ fct convert -t cql -i /some/path/Patient-1.0.0.cql +``` + +**Options** +``` +-t or --type - the type of conversion, can be sm for structure map to json or cql for cql to json library +-i or --input - the input file or file path +-o or --output - the output path, can be a file or directory. Optional - default is current directory +``` + +### Extracting resources from questionnaire response +To extract FHIR Resources you can run the command: +```console +$ fct extract -qr /patient-registration-questionnaire/questionnaire-response.json -sm /path/to/patient-registration-questionnaire/structure-map.txt +``` + +**Options** +``` +-qr or --questionnaire-response - the questionnaire response json file +-sm or --structure-map - the path to the structure map file +-o or --output - the output path, can be a file or directory. Optional - default is current directory +``` + +### Validating your app configurations +The tool supports some validations for the FHIRCore app configurations. To validate you can run the command: +```console +$ fct validate -c ~/path/to/composition_config_file.json -i ~/Workspace/fhir-resources//app_configs/ +``` +The above will output a list of errors and warnings based on any configuration rules that have been violated. + +**Options** +``` +-c or --composition - the composition json file of the project +-i or --input - the input directory path. This should point to the folder with the app configurations e.g. ~/Workspace/fhir-resources/ecbis_cha_preview/ +-o or --output - the output path, can be a file or directory. Optional - default is current directory +-sm or --structure-maps - (Optional) the directory path to the location of structure map .txt or .map files. Must be a directory. Must be used with the -q flag +-q or --questionnaires - (Optional) the directory path to the location of questionnaires .json files. Must be a directory. Must be used with the -sm flag +``` + +**Note:** To include _Questionnaire_ and _Structure Map_ validation add the `-sm` and `-q` flags + +**Sample screenshot output** +
+Screenshot 2023-03-27 at 21 43 09 + +## Development +### Set up +This is a Java + Kotlin maven project. You can import it in you JetBrains IntelliJ IDE as such. The utility is built on the very awesome `Picocli` library found here https://picocli.info/. + +### Building +To build and create a new jar file run the maven package command + +`mvn spotless:apply package` diff --git a/pom.xml b/efsity/pom.xml similarity index 100% rename from pom.xml rename to efsity/pom.xml diff --git a/src/main/java/org/smartregister/Main.java b/efsity/src/main/java/org/smartregister/Main.java similarity index 100% rename from src/main/java/org/smartregister/Main.java rename to efsity/src/main/java/org/smartregister/Main.java diff --git a/src/main/java/org/smartregister/command/ConvertCommand.java b/efsity/src/main/java/org/smartregister/command/ConvertCommand.java similarity index 100% rename from src/main/java/org/smartregister/command/ConvertCommand.java rename to efsity/src/main/java/org/smartregister/command/ConvertCommand.java diff --git a/src/main/java/org/smartregister/command/StructureMapExtractResourcesCommand.java b/efsity/src/main/java/org/smartregister/command/StructureMapExtractResourcesCommand.java similarity index 100% rename from src/main/java/org/smartregister/command/StructureMapExtractResourcesCommand.java rename to efsity/src/main/java/org/smartregister/command/StructureMapExtractResourcesCommand.java diff --git a/src/main/java/org/smartregister/command/ValidateCommand.java b/efsity/src/main/java/org/smartregister/command/ValidateCommand.java similarity index 100% rename from src/main/java/org/smartregister/command/ValidateCommand.java rename to efsity/src/main/java/org/smartregister/command/ValidateCommand.java diff --git a/src/main/java/org/smartregister/domain/FCTFile.java b/efsity/src/main/java/org/smartregister/domain/FCTFile.java similarity index 100% rename from src/main/java/org/smartregister/domain/FCTFile.java rename to efsity/src/main/java/org/smartregister/domain/FCTFile.java diff --git a/src/main/java/org/smartregister/util/FCTUtils.java b/efsity/src/main/java/org/smartregister/util/FCTUtils.java similarity index 100% rename from src/main/java/org/smartregister/util/FCTUtils.java rename to efsity/src/main/java/org/smartregister/util/FCTUtils.java diff --git a/src/main/java/org/smartregister/util/FCTValidationEngine.java b/efsity/src/main/java/org/smartregister/util/FCTValidationEngine.java similarity index 100% rename from src/main/java/org/smartregister/util/FCTValidationEngine.java rename to efsity/src/main/java/org/smartregister/util/FCTValidationEngine.java diff --git a/src/main/java/org/smartregister/util/QuestionnaireProcessor.java b/efsity/src/main/java/org/smartregister/util/QuestionnaireProcessor.java similarity index 100% rename from src/main/java/org/smartregister/util/QuestionnaireProcessor.java rename to efsity/src/main/java/org/smartregister/util/QuestionnaireProcessor.java diff --git a/src/main/java/org/smartregister/util/StructureMapProcessor.java b/efsity/src/main/java/org/smartregister/util/StructureMapProcessor.java similarity index 100% rename from src/main/java/org/smartregister/util/StructureMapProcessor.java rename to efsity/src/main/java/org/smartregister/util/StructureMapProcessor.java diff --git a/src/main/kotlin/org/smartregister/external/CQLToLibraryConvertServices.kt b/efsity/src/main/kotlin/org/smartregister/external/CQLToLibraryConvertServices.kt similarity index 100% rename from src/main/kotlin/org/smartregister/external/CQLToLibraryConvertServices.kt rename to efsity/src/main/kotlin/org/smartregister/external/CQLToLibraryConvertServices.kt diff --git a/src/main/kotlin/org/smartregister/external/TransformSupportServices.kt b/efsity/src/main/kotlin/org/smartregister/external/TransformSupportServices.kt similarity index 100% rename from src/main/kotlin/org/smartregister/external/TransformSupportServices.kt rename to efsity/src/main/kotlin/org/smartregister/external/TransformSupportServices.kt diff --git a/src/main/resources/dependency-set.xml b/efsity/src/main/resources/dependency-set.xml similarity index 100% rename from src/main/resources/dependency-set.xml rename to efsity/src/main/resources/dependency-set.xml diff --git a/importer/README.md b/importer/README.md new file mode 100644 index 0000000..0d9f0a8 --- /dev/null +++ b/importer/README.md @@ -0,0 +1 @@ +To implement [FHIR Web CSV Import feature](https://docs.google.com/document/d/10prv9DrMBy7ydNmWJxtPBm5c_qBFO6BFLGjwqVIOIq8/edit)