Operations

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

ocdsextensionregistry.api.build_profile(basedir, standard_tag, extension_versions, registry_base_url=None, standard_base_url=None, schema_base_url=None, update_codelist_urls=None)[source]

Pull extensions into a profile.

  • Merge extensions’ JSON Merge Patch files for OCDS’ release-schema.json (schema/profile/release-schema.json)

  • Write extensions’ codelist files (schema/profile/codelists)

  • Patch OCDS’ release-schema.json with extensions’ JSON Merge Patch files (schema/patched/release-schema.json)

  • Patch OCDS’ codelist files with extensions’ codelist files (schema/patched/codelists)

  • Update 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__4'

  • extension_versions – the extension versions

  • registry_base_url (str) – the registry’s base URL, defaults to 'https://raw.githubusercontent.com/open-contracting/extension_registry/main/'

  • standard_base_url (str) – the standard’s base URL, defaults to 'https://codeload.github.com/open-contracting/standard/zip/' + standard_tag

  • 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