Skip to content

Commit

Permalink
Merge branch '1.2-dev' into 1347_building_blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjen authored Jul 3, 2024
2 parents 12d4371 + e7bd89d commit 9fe855d
Show file tree
Hide file tree
Showing 21 changed files with 9,138 additions and 1,030 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install standard [email protected]
- run: npx standard docs/_static/script.js
- uses: biomejs/setup-biome@v2
- run: biome ci --indent-style=space --line-width=119 docs/_static/script.js
3 changes: 2 additions & 1 deletion .github/workflows/shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
- uses: actions/checkout@v4
- run: |
sudo apt update
sudo apt install shellcheck shfmt
sudo apt install devscripts shellcheck shfmt
- run: checkbashisms $(shfmt -f .)
- run: shellcheck $(shfmt -f .)
- run: shfmt -d -i 4 -sr $(shfmt -f .)
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
with:
python-version: '3.10'
- run: pip install codespell
- run: codespell -S .git,docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv -L fo,zar .
- run: codespell -S .git,docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv -L fo,sme,zar,SME .
10 changes: 5 additions & 5 deletions common-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ exceptiongroup==1.0.0
# pytest
h11==0.13.0
# via wsproto
idna==2.10
idna==3.7
# via
# requests
# trio
imagesize==1.4.1
# via sphinx
iniconfig==1.1.1
# via pytest
jinja2==3.1.3
jinja2==3.1.4
# via
# myst-parser
# sphinx
Expand Down Expand Up @@ -123,7 +123,7 @@ pytz==2021.1
# via babel
pyyaml==6.0.1
# via myst-parser
requests==2.31.0
requests==2.32.2
# via
# elasticsearch
# ocdsextensionregistry
Expand Down Expand Up @@ -151,7 +151,7 @@ sphinx==5.3.0
# sphinx-intl
sphinx-autobuild==2021.3.14
# via -r common-requirements.in
sphinx-intl==2.1.0
sphinx-intl==2.2.0
# via -r common-requirements.in
sphinxcontrib-applehelp==1.0.2
# via sphinx
Expand All @@ -171,7 +171,7 @@ tomli==2.0.1
# pip-tools
# pyproject-hooks
# pytest
tornado==6.3.3
tornado==6.4.1
# via livereload
trio==0.20.0
# via
Expand Down
138 changes: 72 additions & 66 deletions docs/_static/script.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
/* global XMLHttpRequest, location, renderjson */

const pathComponents = window.location.pathname.split('/')
if (pathComponents[pathComponents.length - 2] === 'codelists') {
document.querySelector('.wy-nav-content').style.maxWidth = 'none'
const pathComponents = window.location.pathname.split("/");
if (pathComponents[pathComponents.length - 2] === "codelists") {
document.querySelector(".wy-nav-content").style.maxWidth = "none";
}

// FYI: extensionlist appears many times on /schema/reference/
if (document.querySelector('.extension_list')) {
const language = location.pathname.split('/')[2]
if (document.querySelector(".extension_list")) {
const language = location.pathname.split("/")[2];

// Append an empty list for community extensions.
document.querySelectorAll('.extension_list .hide').forEach(element => {
const dl = document.createElement('dl')
dl.className = 'simple community-list hide'
element.insertAdjacentElement('afterend', dl)
element.innerHTML = `<small>${element.innerHTML}</small>`
})
for (const element of document.querySelectorAll(".extension_list .hide")) {
const dl = document.createElement("dl");
dl.className = "simple community-list hide";
element.insertAdjacentElement("afterend", dl);
element.innerHTML = `<small>${element.innerHTML}</small>`;
}

// Get the community extensions to add to the documentation.
const request = new XMLHttpRequest()
request.open('GET', 'https://raw.githubusercontent.com/open-contracting/extension_registry/main/build/extensions.json')
request.responseType = 'json'
const request = new XMLHttpRequest();
request.open(
"GET",
"https://raw.githubusercontent.com/open-contracting/extension_registry/main/build/extensions.json",
);
request.responseType = "json";

request.onload = () => {
if (request.status >= 200 && request.status < 400) {
// Add community extensions.
request.response.extensions.forEach(extension => {
for (const extension of request.response.extensions) {
if (!extension.core) {
const div = document.getElementById(`extensionlist-${extension.category}`)
const div = document.getElementById(`extensionlist-${extension.category}`);
if (div) {
div.querySelector('.community-list').insertAdjacentHTML('beforeend', `
div.querySelector(".community-list").insertAdjacentHTML(
"beforeend",
`
<dt>
<a class="reference external" href="${extension.documentation_url}">
${extension.name[language] || extension.name.en}
Expand All @@ -38,79 +43,80 @@ if (document.querySelector('.extension_list')) {
<dd>
${extension.description[language] || extension.description.en}
</dd>
`)
div.querySelectorAll('.hide').forEach(element => {
element.classList.remove('hide')
})
`,
);
for (const element of div.querySelectorAll(".hide")) {
element.classList.remove("hide");
}
}
}
})
}

// Remove empty extension lists.
document.querySelectorAll('.extension_list').forEach(element => {
if (!element.querySelector('a')) {
element.remove()
for (const element of document.querySelectorAll(".extension_list")) {
if (!element.querySelector("a")) {
element.remove();
}
})
}
}
}
};

request.send()
request.send();
}

document.querySelectorAll('.expandjson').forEach(element => {
const defaultOpen = []
let fileClassName
element.classList.forEach(className => {
if (className.substring(0, 7) === 'expand-' && className.length > 7) {
defaultOpen.push(className.substring(7))
for (const element of document.querySelectorAll(".expandjson")) {
const defaultOpen = [];
let fileClassName;
for (const className of element.classList) {
if (className.substring(0, 7) === "expand-" && className.length > 7) {
defaultOpen.push(className.substring(7));
}
if (className.substring(0, 5) === 'file-') {
fileClassName = className
if (className.substring(0, 5) === "file-") {
fileClassName = className;
}
})
}

let data = JSON.parse(element.textContent)
let data = JSON.parse(element.textContent);
// If the jsoninclude directive indexed to a JSON array (a common mistake), only display the first entry.
if (data.length) {
data = data[0]
data = data[0];
}

const replacement = renderjson.set_show_to_level(1).set_max_string_length(100).set_default_open(defaultOpen)(data)
const replacement = renderjson.set_show_to_level(1).set_max_string_length(100).set_default_open(defaultOpen)(data);
// element.firstElementChild.replaceWith(replacement) // https://caniuse.com/mdn-api_parentnode_firstelementchild
element.replaceChild(replacement, element.querySelector('.highlight-json'))
element.replaceChild(replacement, element.querySelector(".highlight-json"));

const container = element.previousElementSibling
let select
if (container && container.classList.contains('selection-container')) {
const container = element.previousElementSibling;
let select;
if (container?.classList.contains("selection-container")) {
// Hide additional examples.
element.style.display = 'none'
container.appendChild(element)
element.style.display = "none";
container.appendChild(element);

// Display the select element if there are multiple options.
select = container.querySelector('select')
select.style.display = ''
select = container.querySelector("select");
select.style.display = "";
} else {
const div = document.createElement('div')
element.insertAdjacentElement('beforebegin', div)
div.className = 'selection-container'
div.appendChild(element)
const div = document.createElement("div");
element.insertAdjacentElement("beforebegin", div);
div.className = "selection-container";
div.appendChild(element);

select = document.createElement('select')
div.insertAdjacentElement('afterbegin', select)
select = document.createElement("select");
div.insertAdjacentElement("afterbegin", select);

// Hide the select element if there is one option.
select.style.display = 'none'
select.addEventListener('change', () => {
div.querySelectorAll('.expandjson').forEach(child => {
child.style.display = 'none'
})
div.querySelector(`.${select.value}`).style.display = ''
})
select.style.display = "none";
select.addEventListener("change", () => {
for (const child of div.querySelectorAll(".expandjson")) {
child.style.display = "none";
}
div.querySelector(`.${select.value}`).style.display = "";
});
}

const option = document.createElement('option')
option.value = fileClassName
option.textContent = fileClassName.replace('file-', '')
select.appendChild(option)
})
const option = document.createElement("option");
option.value = fileClassName;
option.textContent = fileClassName.replace("file-", "");
select.appendChild(option);
}
61 changes: 61 additions & 0 deletions docs/examples/release_schema_reference/release_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,47 @@
"projectID": "SP001",
"uri": "https://openspending.org/uk-barnet-budget/entries/6801ad388f3a38b7740dde20108c58b35984ee91"
},
"project": {
"id": "oc4ids-bu3kcz-0000",
"title": "Central Junction Cycle Lane Construction",
"description": "Design, construction and supervision of a new cycle lane for the Central Junction.",
"totalValue": {
"amount": 1100000,
"currency": "GBP"
},
"uri": "http://example.com/projects/oc4ids-bu3kcz-0000.json",
"sector": {
"id": "transport.road",
"description": "Road transport, including roads, highways, streets, tunnels and bridges.",
"scheme": "oc4idsProjectSector"
},
"additionalClassifications": [
{
"id": "03.04.05",
"description": "Cycle lanes for road transport.",
"scheme": "GB-EXAMPLE"
}
],
"locations": [
{
"description": "Barnet, London, UK",
"geometry": {
"type": "Point",
"coordinates": [
51.605,
0.2076
]
},
"gazetteer": {
"scheme": "GEONAMES",
"identifier": [
"2656295"
]
},
"uri": "https://www.geonames.org/2656295/barnet.html"
}
]
},
"documents": [
{
"datePublished": "2009-01-05T00:00:00Z",
Expand Down Expand Up @@ -155,6 +196,26 @@
"currency": "GBP"
}
}
},
{
"id": "0002",
"description": "Paint for road markings",
"classification": {
"scheme": "CPV",
"id": "44811000",
"description": "Road paint",
"uri": "http://cpv.data.ac.uk/code-44811000"
},
"immediateContainer": {
"name": "Can/Tin",
"capacity": {
"unit": {
"scheme": "UNCEFACT",
"id": "GLI"
},
"value": "[100,100]"
}
}
}
],
"value": {
Expand Down
2 changes: 1 addition & 1 deletion docs/guidance/map/linked_standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The [Open Contracting for Infrastructure Data Standards](https://standard.open-c

A joint effort by the [Infrastructure Transparency Initiative](https://infrastructuretransparency.org) (CoST) and the Open Contracting Partnership, it builds on best practice in open data and openness of public infrastructure procurement globally.

The [Project](https://extensions.open-contracting.org/en/extensions/project/master/) extension describes how to connect OCDS and OC4IDS datasets.
OC4IDS datasets ought to be linked from OCDS datasets using the `planning.project` object, by referencing the OC4IDS project identifier in the `planning.project.id` field.

## Open Fiscal Data Package

Expand Down
6 changes: 3 additions & 3 deletions docs/guidance/map/translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ You can publish the values of these fields in any language:
- `description`, in any location
- `finalStatusDetails`, in any location
- `legalName`, in any location
- `locality`, in any location
- `name`, in any location
- `rationale`, in any location
- `region`, in any location
- `streetAddress`, in any location
- `title`, in any location
- `parties/address/locality`
- `parties/address/region`
- `parties/address/streetAddress`
- `planning/budget/project`
- `tender/awardCriteriaDetails`
- `tender/procurementMethodDetails`
Expand Down
Loading

0 comments on commit 9fe855d

Please sign in to comment.