Skip to content

Commit

Permalink
Merge pull request #8 from bmeg/fix/duplicate-edges
Browse files Browse the repository at this point in the history
Adds readme
  • Loading branch information
matthewpeterkort authored Aug 15, 2024
2 parents 0048f0e + 4925ec1 commit 713fabc
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,72 @@
## Setup

To install, from root:

```
go install .
```

```
jsonschemagraph
Usage:
jsonschemagraph [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
gen-graph Gen graph
help Help about any command
schema-graph Schema graph <dir>
schema-lint Schema lint
completion Generate the autocompletion script for the specified shell
data-validate Data Validate
gen-dir Generates edges and vertices from source directory and schema dir
gen-graph Generates edges and vertices from source data files and schemas
help Help about any command
schema-graph Generates a d2 file to visualize graph schema structure
schema-lint Checks a directory of yaml schemas for syntax errors
Flags:
-h, --help help for jsonschemagraph
Use "jsonschemagraph [command] --help" for more information about a command.
Use "jsonschemagraph [command] --help" for more information about a command
```

To test:

```
cd cmds/gengraph
go test
```

To install d2 graph description language used for schema-graph command:

```
curl -fsSL https://d2lang.com/install.sh | sh -s --
```

Since some of the source data has keys that have null values some of these test cases will fail. This is expected.

## Expected Program Structure:

```bash
.
├── README.md
├── cmd
│   ├── gengraph
│   ├── data_validate
│   │   └── main.go
│   ├── gen_dir
│   │   └── main.go
│   ├── gen_graph
│   │   ├── main.go
│   │   └── main_test.go
│   │   ├── main_test.go
│   │   └── schema.json
│   ├── root.go
│   ├── schema_graph
│   │   └── main.go
│   └── schema_lint
│   └── main.go
├── go.mod
├── go.sum
├── main.go
├── data/
├── schemas/
├── output/
└── util
├── delete_empty.go
├── generate.go
├── loader.go
├── methods.go
├── read_file.go
├── tools.go
└── validate.go
```

Expand All @@ -67,10 +77,13 @@ Output is an example name of the directory that the edges and vertices will be o
Schemas is the location of your schema files

## Example Commands

Generate edge and vertex files

```
jsonschemagraph gen-graph [schema_directory_location] [data_file_location] [output_directory_location] [schema_class_name]
```

SWAPI Example: jsonschemagraph gen-graph schemas/ data/swapi/swapi_character.json.gz output character

BMEG Example: jsonschemagraph gen-graph schemas/bmeg_schemas data/ensembl_transcript.json.gz output Transcript
Expand All @@ -80,13 +93,14 @@ FHIR Example: jsonschemagraph gen-graph schemas/all_fhir_schemas aced-data/actua
Note: the fhir data used in the above example is an ndjson file of FHIR Observations

Check to see if the schemas in a directory are valid

```
jsonschemagraph schema-lint [schema_directory_location]
```

Generate a d2 graphical representation of a directory of graph schemas

```
jsonschemagraph schema-graph [schema_directory_location] > in.d2
d2 --watch in.d2 out.svg
```

0 comments on commit 713fabc

Please sign in to comment.