Skip to content

Commit

Permalink
schema/project-level/project-schema.json: Add and update fields
Browse files Browse the repository at this point in the history
Add project-level transactions. Add milestones to projects and contracting processes. Add milestoneType and milestoneStatus codelists. Update schema for latest version of OCDS for PPPs
  • Loading branch information
duncandewhurst committed Nov 10, 2023
1 parent 22caf9a commit f19cb02
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 28 deletions.
35 changes: 28 additions & 7 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
import sys
import warnings
from collections import defaultdict
from collections import defaultdict, OrderedDict
from copy import deepcopy
from io import StringIO
from pathlib import Path
Expand Down Expand Up @@ -473,6 +473,7 @@ def copy_element(name, replacements=None, root='definitions'):
'projectType.csv',
'relatedProjectScheme.csv',
'relatedProject.csv',
'classificationScheme.csv',
}
ocds_codelists = {
'currency.csv',
Expand All @@ -485,6 +486,8 @@ def copy_element(name, replacements=None, root='definitions'):
'partyRole.csv',
'releaseTag.csv',
'unitClassificationScheme.csv',
'milestoneType.csv',
'milestoneStatus.csv',
}
compare([path.name for path in codelists_dir.iterdir()], infra_codelists, ocds_codelists,
'schema/project-level/codelists', 'codelists')
Expand All @@ -496,6 +499,7 @@ def copy_element(name, replacements=None, root='definitions'):
'Modification',
'RelatedProject', # Similar to relatedProcess in OCDS
'Person',
'SimpleIdentifier',
}
ocds_definitions = {
'Period',
Expand All @@ -512,6 +516,7 @@ def copy_element(name, replacements=None, root='definitions'):
'Metric',
'Observation',
'Transaction',
'Milestone'
}
compare(schema['definitions'], infra_definitions, ocds_definitions,
'schema/project-level/project-schema.json#/definitions', 'definitions')
Expand Down Expand Up @@ -630,12 +635,11 @@ def copy_element(name, replacements=None, root='definitions'):
})

copy_element('Classification', {
# Remove line item classifications from the definition.
('properties', 'scheme', 'description'): lambda s: s[:s.index(' For line item classifications,')],
# Replace line item classification scheme codelist with classification scheme codelist
('properties', 'scheme', 'description'): lambda s: s.replace('. For line item classifications, this uses the open [itemClassificationScheme](https://standard.open-contracting.org/1.1/en/schema/codelists/#item-classification-scheme) codelist.', ', using the open [classificationScheme](https://standard.open-contracting.org/infrastructure/{{version}}/{{lang}}/reference/codelists/#classificationscheme) codelist.'), # noqa: E501
})
# Remove the `itemClassificationScheme.csv` codelist.
del schema['definitions']['Classification']['properties']['scheme']['codelist']
del schema['definitions']['Classification']['properties']['scheme']['openCodelist']
# Replace line item classification scheme codelist with classification scheme codelist
schema['definitions']['Classification']['properties']['scheme']['codelist'] = 'classificationScheme.csv'

copy_element('Location')
# Original from ocds_location_extension: "The location where activity related to this tender, contract or license will be delivered, or will take place. A location can be described by either a geometry (point location, line or polygon), or a gazetteer entry, or both." # noqa: E501
Expand All @@ -653,6 +657,7 @@ def copy_element(name, replacements=None, root='definitions'):
'description': 'A physical address where works will take place.',
'$ref': '#/definitions/Address',
}
schema['definitions']['Location']['properties'] = OrderedDict(schema['definitions']['Location']['properties'])
schema['definitions']['Location']['properties'].move_to_end('id', last=False)
schema['definitions']['Location']['required'] = ['id']

Expand Down Expand Up @@ -693,7 +698,13 @@ def copy_element(name, replacements=None, root='definitions'):
('properties', 'name', 'description'): lambda s: s.replace('contracting process', 'project'),
})

copy_element('BudgetBreakdown')
copy_element('BudgetBreakdown', {
# Refer to project instead of contracting process
('properties', 'amount', 'description'): lambda s: s.replace('contracting process', 'project',)
})
# Add approval date
schema['definitions']['BudgetBreakdown']['properties']['approvalDate'] = deepcopy(schema['properties']['budget']['properties']['approvalDate']) # noqa: E501
schema['definitions']['BudgetBreakdown']['properties']['approvalDate']['description'] = "The date on which this budget entry was approved. Where documentary evidence for this exists, it may be included among the project documents with `.documentType` set to 'budgetApproval'." # noqa: E501

copy_element('Document', {
# Link to infrastructure codelist instead of PPP codelist
Expand All @@ -717,6 +728,16 @@ def copy_element(name, replacements=None, root='definitions'):
del schema['definitions']['Observation']['properties']['relatedImplementationMilestone']

copy_element('Transaction')
# Original from standard: "A spending transaction related to the contracting process. Draws upon the data models of the [Fiscal Data Package](https://frictionlessdata.io/specs/fiscal-data-package/) and the [International Aid Transparency Initiative](http://iatistandard.org/activity-standard/iati-activities/iati-activity/transaction/) and should be used to cross-reference to more detailed information held using a Fiscal Data Package, IATI file, or to provide enough information to allow a user to manually or automatically cross-reference with some other published source of transactional spending data." # noqa: E501
schema['definitions']['Transaction']['description'] = "A financial transaction related to a project or contracting process. Draws upon the data models of the Fiscal Data Package and the International Aid Transparency Initiative and should be used to cross-reference to more detailed information held using a Fiscal Data Package, IATI file, or to provide enough information to allow a user to manually or automatically cross-reference with some other published source of transactional data." # noqa: E501

copy_element('Milestone')
# Original from standard: "The milestone block can be used to represent a wide variety of events in the lifetime of a contracting process." # noqa: E501
schema['definitions']['Milestone']['description'] = "An event in the lifetime of a project or contracting process." # noqa: E501
# Original from standard: "A local identifier for this milestone, unique within this block. This field is used to keep track of multiple revisions of a milestone through the compilation from release to record mechanism." # noqa: E501
schema['definitions']['Milestone']['properties']['id']['description'] = "A local identifier for this milestone, unique within this block." # noqa: E501
# Original from standard: "Milestone codes can be used to track specific events that take place for a particular kind of contracting process. For example, a code of 'approvalLetter' can be used to allow applications to understand this milestone represents the date an approvalLetter is due or signed." # noqa: E501
schema['definitions']['Milestone']['properties']['code']['description'] = "Milestone codes can be used to track specific events that take place for a particular kind of project or contracting process. For example, a code of 'approvalLetter' can be used to allow applications to understand this milestone represents the date an approvalLetter is due or signed." # noqa: E501

remove_null_and_pattern_properties(schema)
remove_integer_identifier_types(schema)
Expand Down
5 changes: 5 additions & 0 deletions schema/project-level/codelists/milestoneStatus.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Code,Title,Description,Extension
scheduled,Scheduled,This milestone has been scheduled for the date in milestone.dueDate. Progress towards the milestone has not yet been evaluated as of milestone.dateModified.,OCDS Core
met,Met,This milestone has been achieved. The date on which it was met should be placed in the milestone.dateMet field.,OCDS Core
notMet,Not met,This milestone had not been met at the date it was last reviewed (see milestone.dateModified).,OCDS Core
partiallyMet,Partially met,This milestone was judged to have been partially met at the date it was last reviewed (see milestone.dateModified).,OCDS Core
11 changes: 11 additions & 0 deletions schema/project-level/codelists/milestoneType.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Code,Title,Description,Extension
preProcurement,Pre-procurement milestones,"For events during the planning or pre-procurement phase of a process, such as the preparation of key studies.",OCDS Core
approval,Approval milestones,For events such as the sign-off of a contract or project.,OCDS Core
engagement,Engagement milestones,"For engagement milestones, such as a public hearing.",OCDS Core
assessment,Assessment milestones,"For assessment and adjudication milestones, such as the meeting date of a committee.",OCDS Core
delivery,Delivery milestones,"For delivery milestones, such as the date when a good or service is to be provided.",OCDS Core
reporting,Reporting milestones,"For reporting milestones, such as when key reports are to be provided.",OCDS Core
financing,Financing milestones,"For events related to the funding of the project or contracting process. In public-private partnerships, such events might include, for example, planned payments and equity transfers.",OCDS Core
payment,Payment milestones,"For payment milestones, such as the date when a payment is expected to be made to a supplier. If the `status` of a project or contracting process's payment milestone is 'met', then the contract ought to have an entry for the payment under its `.transactions`.",OCDS Core
procurement,Procurement,"Events taking place during the procurement which are not captured by fields in core OCDS, such as additional enquiry periods or draft tender submissions in a competitive dialogue process",OCDS for PPPs Extension
contractClose,Contract close,Events such as commercial and financial close,OCDS for PPPs Extension
Loading

0 comments on commit f19cb02

Please sign in to comment.