Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (49 sloc) 2.37 KB
###############################################################################
###
### poc.py - A test harness that demonstrates the proof-of-concept.
###
### gov.uk Metadata Standards are a way to increase the interoperability of
### spreadsheets between government departments.
###
### poc.py implements the proof-of-concept proposal described in
### https://docs.google.com/presentation/d/1eEc8s3_eNx_b5vMxWpF-BiueDfaz6mD6zbamXbSy1Z4
###
###
### Copyright (C) 2019, Andy Bennett, Crown Copyright (Government Digital Service).
###
### Permission is hereby granted, free of charge, to any person obtaining a
### copy of this software and associated documentation files (the "Software"),
### to deal in the Software without restriction, including without limitation
### the rights to use, copy, modify, merge, publish, distribute, sublicense,
### and#or sell copies of the Software, and to permit persons to whom the
### Software is furnished to do so, subject to the following conditions:
###
### The above copyright notice and this permission notice shall be included in
### all copies or substantial portions of the Software.
###
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
### THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
### FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
### DEALINGS IN THE SOFTWARE.
###
### Andy Bennett <andyjpb@digital.cabinet-office.gov.uk>, 2019/03/19
###
###############################################################################
import slang
################################################################################
# Configuration
METADATA = "poc.slang"
SPREADSHEETS = ["office-supplies-order.ods"]
################################################################################
# Main program logic
print("Reading metadata from %s..." % METADATA)
metadata = slang.slang(open(METADATA))
metadata.parse()
for sheet in SPREADSHEETS:
print("Validating spreadsheet %s against metadata..." % sheet)
instance = metadata.validate(open(sheet))
print("Extracting typed data from spreadsheet...")
print instance.extract()
You can’t perform that action at this time.