Profile Builder

from ocdsextensionregistry import ProfileBuilder

builder = ProfileBuilder('1__1__3', {
    'lots': 'v1.1.3',
    'bids': 'v1.1.3',
})

This initializes a profile of OCDS 1.1.3 with two extensions. Alternately, you can pass a list of extensions’ metadata URLs, base URLs and/or download URLs, for example:

builder = ProfileBuilder('1__1__3', [
  'https://raw.githubusercontent.com/open-contracting-extensions/ocds_coveredBy_extension/master/extension.json',
  'https://raw.githubusercontent.com/open-contracting-extensions/ocds_options_extension/master/',
  'https://github.com/open-contracting-extensions/ocds_techniques_extension/archive/master.zip',
])

After initializing the profile, you can then:

class ocdsextensionregistry.profile_builder.ProfileBuilder(standard_tag, extension_versions, registry_base_url=None, schema_base_url=None)[source]
__init__(standard_tag, extension_versions, registry_base_url=None, schema_base_url=None)[source]

Accepts an OCDS version and either a dictionary of extension identifiers and versions, or a list of extensions’ metadata URLs, base URLs and/or download URLs, and initializes a reader of the extension registry.

Parameters:
  • standard_tag (str) – the OCDS version tag, e.g. '1__1__3'
  • extension_versions (dict or list) – 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/'
extensions()[source]

Returns the matching extension versions from the registry.

release_schema_patch(extension_field=None)[source]

Returns the consolidated release schema patch.

Parameters:extension_field (str) – the property with which to annotate each definition and field with the name of the extension in which the definition or field is defined
patched_release_schema(schema=None, extension_field=None)[source]

Returns the patched release schema.

Parameters:
  • schema (dict) – the release schema
  • extension_field (str) – the property with which to annotate each definition and field with the name of the extension in which the definition or field is defined
release_package_schema(schema=None)[source]

Returns a release package schema. If schema_base_url was provided, updates schema URLs.

Parameters:schema (dict) – the release schema
standard_codelists()[source]

Returns the standard’s codelists as Codelist objects.

extension_codelists()[source]

Returns the extensions’ codelists as Codelist objects.

The extensions’ codelists may be new, or may add codes to (+name.csv), remove codes from (-name.csv) or replace (name.csv) the codelists of the standard or other extensions.

Codelist additions and removals are merged across extensions. If new codelists or codelist replacements differ across extensions, an error is raised.

patched_codelists()[source]

Returns patched and new codelists as Codelist objects.

get_standard_file_contents(basename)[source]

Returns the contents of the file within the standard.

Downloads the given version of the standard, and caches the contents of files in the schema/ directory.