Skip to content

Commit

Permalink
Add abstract and description to register.json
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Jan 12, 2024
1 parent d2cd244 commit 7c06ac6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ogc/bblocks/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
id_prefix = 'ogc.'
annotated_path = Path(args.annotated_path)
imported_registers = []
register_additional_metadata = {}
if bb_config_file and bb_config_file.is_file():
bb_config = load_yaml(filename=bb_config_file)
id_prefix = bb_config.get('identifier-prefix', id_prefix)
Expand All @@ -169,6 +170,13 @@
else:
imported_registers = [ir if ir != DEFAULT_IMPORT_MARKER else MAIN_BBR for ir in imported_registers if ir]

register_abstract = bb_config.get('abstract')
if register_abstract:
register_additional_metadata['abstract'] = register_abstract
register_description = bb_config.get('description')
if register_description:
register_additional_metadata['description'] = register_description

base_url = args.base_url
github_base_url = args.github_base_url
git_repo_path = None
Expand Down Expand Up @@ -207,7 +215,8 @@
bb_filter=args.filter,
steps=steps,
git_repo_path=git_repo_path,
viewer_path=(args.viewer_path or '.') if deploy_viewer else None)
viewer_path=(args.viewer_path or '.') if deploy_viewer else None,
additional_metadata=register_additional_metadata)

# 2. Uplift register.json
print(f"Running semantic uplift of {register_file}", file=sys.stderr)
Expand Down
9 changes: 8 additions & 1 deletion ogc/bblocks/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def postprocess(registered_items_path: str | Path = 'registereditems',
steps: list[str] | None = None,
bbr_config: dict | None = None,
git_repo_path: Path | None = None,
viewer_path: str | Path | None = None) -> list[dict]:
viewer_path: str | Path | None = None,
additional_metadata: dict | None = None) -> list[dict]:

cwd = Path().resolve()

Expand Down Expand Up @@ -328,6 +329,12 @@ def do_postprocess(bblock: BuildingBlock, light: bool = False) -> bool:
output_register_json['viewerURL'] = urljoin(base_url, viewer_path)
if full_validation_report_url:
output_register_json['validationReport'] = full_validation_report_url

if additional_metadata:
for k, v in additional_metadata.items():
if k not in output_register_json:
output_register_json[k] = v

if output_file == '-':
print(json.dumps(output_register_json, indent=2, cls=CustomJSONEncoder))
else:
Expand Down

0 comments on commit 7c06ac6

Please sign in to comment.