Profile Builder#
from ocdsextensionregistry import ProfileBuilder
builder = ProfileBuilder('1__1__4', {
'lots': 'v1.1.4',
'bids': 'v1.1.4',
})
This initializes a profile of OCDS 1.1.4 with two extensions. Alternately, you can pass a list of extensions’ metadata URLs, base URLs, download URLs, and/or absolute paths to local directories, for example:
builder = ProfileBuilder('1__1__4', [
'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',
'file:///absolute/path/to/ocds_lots_extension',
])
After initializing the profile, you can then:
release_schema_patch()
to get the profile’s patch ofrelease-schema.json
patched_release_schema()
to get the patched version ofrelease-schema.json
extension_codelists()
to get the profile’s codelistspatched_codelists()
to get the patched codelistsextensions()
to iterate over the profile’s versions of extensions
- class ocdsextensionregistry.profile_builder.ProfileBuilder(standard_tag, extension_versions, registry_base_url=None, standard_base_url=None, schema_base_url=None)[source]#
- __init__(standard_tag, extension_versions, registry_base_url=None, standard_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__4'
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/'
- release_schema_patch(extension_field=None, language='en')[source]#
Returns the consolidated release schema patch.
- patched_release_schema(schema=None, extension_field=None, language='en')[source]#
Returns the patched release schema.
- release_package_schema(schema=None, embed=False)[source]#
Returns a release package schema. If the profile builder was initialized with
schema_base_url
, updates schema URLs.
- record_package_schema(schema=None, embed=False)[source]#
Returns a record package schema. If the profile builder was initialized with
schema_base_url
, updates schema URLs.
- 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.