Skip to content

Instantly share code, notes, and snippets.

import json
from simple_salesforce import Salesforce
from urllib.parse import urlparse
sf = Salesforce(username='[email protected]', password='', security_token='')
def clean_object(obj):
new_obj = {}
print(obj)
obj.pop("attributes", None)
drop table if exists record_compiled_release;
select ocid, data -> 'compiledRelease' as compiledRelease into record_compiled_release from record join data on record.data_id = data.id;
drop table if exists record_compiled_release_flat;
WITH RECURSIVE all_paths(ocid, path, "value") AS (
select ocid,
(key_value).key "path",
(key_value).value "value" from
(select ocid, jsonb_each(compiledRelease) key_value from record_compiled_release) a
import hashlib
import glob
import shutil
from ocdsdata import util
from ocdsdata.base import Source
from ocdsdata.util import save_content
import xml.etree.ElementTree as ET
tree = ET.parse("worker_co-operative_cls_0.xml")
root = tree.getroot()
stuff_to_print = ""
attrib = {"top": 0, "left": 0}
line_start = 0
Co-operatives UK Worker Co-operative Model – Company Limited by Shares
Companies Act 2006
Private Company Limited by Shares
Articles of
## This file needs to be coppied to the root of the standard repo and run there.
## It makes a directory called extensions_translate with folder for english (en)
## and the languages specified here
languages = ['es', 'fr']
## This is the version of the schema used for fetching the core extensions from the extension registry
version = '1.1.3'
from ocds_documentation_support import translate_schema
This file has been truncated, but you can view the full file.
[
{
"path": "//iati-activities/@version",
"codelist": "Version",
"data": {
"attributes": {
"name": "Version",
"complete": "1",
"category-codelist": null
},
[
{
"occur": "..",
"section": true,
"type": "",
"path": "iati-activities",
"doc": "/activity-standard/iati-activities",
"name": "iati-activities",
"description": "\nTop-level list of one or more IATI activity records.\n"
},
var jsf = require('json-schema-faker');
var schema = require('./release-package-schema.json');
var releaseSchema = require('./release-schema.json');
jsf.format('URI', function(gen, schema) {
return gen.randexp('^http://.*\.com$');
});
@kindly
kindly / ocdsmerge.js
Created May 11, 2016 10:36
Start of work on ocds merge in javascript.
"use strict";
var NOT_FLATTEN_KEYS = ['additionalIdentifiers',
'additionalClassifications',
'suppliers',
'changes',
'tenderers'
]
function flatten(obj) {