Skip to content

2025 02 10 devdocs #95

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .github/workflows/build_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ jobs:
poetry install
- name: Build Website
run: |
poetry run generate-schema-doc --config template_name=md references/dac5_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/sector_location_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/feature_project_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/project_core_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/generated_sector_location_schema.json docs/dev/
poetry run mkdocs gh-deploy --force
4 changes: 4 additions & 0 deletions docs/dev/dac5_schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# DAC 5 Purpose Code

*Categorical Attributes DAC 5 Purpose Codes is referenced in the Project Core Schema.*

2,489 changes: 2,375 additions & 114 deletions docs/dev/feature_project_schema.md

Large diffs are not rendered by default.

22,385 changes: 22,385 additions & 0 deletions docs/dev/generated_sector_location_schema.md

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions docs/dev/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,39 @@ JSON Schema can aid additional problems on versioning and translations in the fo

We are a number of JSON schemas to define the project location model. You might find the JSON schemas in the `references` folder under `feature_project_schema.json`. They serve as the reference on the allowed fields of the project location model. They defines the structure, data types, and constraints for each field, ensuring consistency and correctness across different implementations. They are then used in the following ways:

1. **Automated tests** We have started to write tests that verify that different data files are conform with the schema. This includes examples files for xlsx, json and csv.
2. **Documentation** We use jsonschema2md to automatically generate the documentation of the model. This documentation can be found [here](feature_project_schema.md).
### **Automated tests**
We have started to write tests that verify that different data files are conform with the schema. This includes examples files for xlsx, json and csv in python.
The tests will executed by the github-pipeline [validation_tests.yml](https://github.com/openkfw/open-geodata-model/blob/main/.github/workflows/validation_tests.yml)
The tests are in the [test-folder](https://github.com/openkfw/open-geodata-model/tree/main/tests)
Run the tests by executing the following steps from the root directory of this project:
```bash
pipx install poetry
poetry install
poetry run pylint tests
poetry run black --check tests
```
### **Documentation**
We use [json-schema-for-humans](https://pypi.org/project/json-schema-for-humans/) to automatically generate the documentation of the model. This documentation can be found [here](feature_project_schema.md).
The documentation will be created automatically by the [build_website.yml](https://github.com/openkfw/open-geodata-model/blob/main/.github/workflows/build_website.yml).
Building the documentation locally run the following steps from the root directory of this project:
```bash
poetry run generate-schema-doc --config template_name=md references/dac5_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/sector_location_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/feature_project_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/project_core_schema.json docs/dev/
poetry run generate-schema-doc --config template_name=md references/generated_sector_location_schema.json docs/dev/
```
The local documentation will be written under the [docs/dev-folder](https://github.com/openkfw/open-geodata-model/tree/main/docs/dev)

In the future, it can serve as the basis of:

- **Data validation**: The schema can be used to validate data files, ensuring that they conform to the expected structure and constraints. This helps catch errors early and maintain data quality.
- **Conversion tools**: The schema can be used to generate conversion tools that transform data between different formats while preserving the integrity of the underlying data model. This can facilitate interoperability between systems that use different data representations.

The follwing sections aren't correctly generated by the docu-generated Tool. Thats the reason why they're listed here explicitly

- [sector_location_schema-doc](sector_location_schema.md) --> [sector_location_schema](https://github.com/openkfw/open-geodata-model/tree/main/references/sector_location_schema.json)
- [generated_sector_location_schema-doc](generated_sector_location_schema.md) --> [generated_sector_location_schema](https://github.com/openkfw/open-geodata-model/tree/main/references/generated_sector_location_schema.json)
### On the relationship between templates and the schema

The schema are references for the project location model. They serve as the foundation for the templates, which are specific instantiations of the model tailored to different use cases. The templates are derived from the schema and provide a user-friendly interface for interacting with the model. They define the fields, labels, and constraints that users see and interact with, while the schema enforces the underlying data model. The filled templates get transformed into the json-format with a unique transformation-script, to then be validated against our schema. Different examples are:
Expand Down
Loading