Skip to content

Commit

Permalink
Merge pull request #2 from onaio/pld-restructure
Browse files Browse the repository at this point in the history
restructure repo, add importer folder
  • Loading branch information
pld authored Jun 21, 2023
2 parents c46912b + 90951d4 commit 4fbeb33
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 80 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
fhircore-tooling.iml
target
.idea
efsity/fhircore-tooling.iml
efsity/target
efsity/.idea
80 changes: 3 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/<project>/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**
<br/>
<img width="715" alt="Screenshot 2023-03-27 at 21 43 09" src="https://user-images.githubusercontent.com/10017086/228037581-209f9bab-d1b9-45eb-a920-aa12c70c5b98.png">

## 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)
79 changes: 79 additions & 0 deletions efsity/README.md
Original file line number Diff line number Diff line change
@@ -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/<project>/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**
<br/>
<img width="715" alt="Screenshot 2023-03-27 at 21 43 09" src="https://user-images.githubusercontent.com/10017086/228037581-209f9bab-d1b9-45eb-a920-aa12c70c5b98.png">

## 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`
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions importer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
To implement [FHIR Web CSV Import feature](https://docs.google.com/document/d/10prv9DrMBy7ydNmWJxtPBm5c_qBFO6BFLGjwqVIOIq8/edit)

0 comments on commit 4fbeb33

Please sign in to comment.