Utilities

Complex operations making use of this library’s classes are organized into this API module.

ocdsextensionregistry.api.identity(text, *args, **kwargs)[source]
ocdsextensionregistry.api.build_profile(basedir, standard_tag, extension_versions, registry_base_url=None, schema_base_url=None, update_codelist_urls=None)[source]

Pulls extensions into a profile.

  • Merges extensions’ JSON Merge Patch files for OCDS’ release-schema.json (schema/profile/release-schema.json)
  • Writes extensions’ codelist files (schema/profile/codelists)
  • Patches OCDS’ release-schema.json with extensions’ JSON Merge Patch files (schema/patched/release-schema.json)
  • Patches OCDS’ codelist files with extensions’ codelist files (schema/patched/codelists)
  • Updates the “codelists” field in extension.json

The profile’s codelists exclude deprecated codes and add an Extension column.

Parameters:
  • basedir (str) – the profile’s schema/ directory
  • standard_tag (str) – the OCDS version tag, e.g. '1__1__3'
  • extension_versions – the extension versions
  • registry_base_url (str) – the registry’s base URL, defaults to 'https://raw.githubusercontent.com/open-contracting/extension_registry/master/'
  • schema_base_url (str) – the schema’s base URL, e.g. 'https://standard.open-contracting.org/profiles/ppp/schema/1__0__0__beta/'
  • update_codelist_urls – a function that accepts a schema as text and a list of names of codelists and replaces the OCDS documentation’s codelist page URLs with the profile’s codelist page URLs