ogt.ags4.*

class ogt.ags4.AGS4GroupDataDict(group_code)[source]

Data dictionary of an ags GROUP, reads the JSON definiton file

Parameters:group_code (str) -- The four character group code
group()[source]

Return the group details; description, status, suggested type etc

Return type:dict
Returns:A dictionary of the group details
heading(head_code)[source]

Return data on a heading (see HEADER)

Parameters:head_code (str) -- The
Returns:a tuple with:
  • A `dict` with the heading details if found, else `None`
  • `True` if heading found, else `False`
headings_list()[source]

Return headings list

Returns:A list of dict items
headings_sort()[source]

A list of headings in correct sort order

Return type:a list of strings
Returns:A list of head_codes
load_def()[source]

Loads the definition file

notes()[source]

Returns notes for this group

Return type:list of strings
Returns:Notes list
to_dict()[source]
Return type:dict
Returns:A dictionary of the definition
ogt.ags4.AGS4_DD = None

This dict contains all the ags4 data, loaded in utils.initialise()

class ogt.ags4.AGS4_DESCRIPTOR[source]

Constants defining the data descriptors (See Rule 3 - Data Descriptors)

data = 'DATA'
group = 'GROUP'
static group_header()[source]

List of header defined in Rule 2a - CRLF New Line

Returns:A list of descriptions in order
heading = 'HEADING'
static list()[source]
type = 'TYPE'
unit = 'UNIT'
class ogt.ags4.Problem(row=None, column=None, field=None, rule=None, group_code=None, head_code=None, message=None, type=None, data=None)[source]

A container for ags validation problems and issues

column = None

The column in the source line

data = None

The data message

field = None

The csv field index

group_code = None

The GROUP

head_code = None

The HEADING

message = None

A quick message

row = None

The row index in the csv file, ie line_no - 1

rule = None

The ags rule (AGS4 - Rules)

ogt.ags4.abbrs()[source]

Return all abbreviations in the ags4 data dict

Return type:dict
Returns:the data if succesful, else None
ogt.ags4.all()[source]

Return everything in the ags4 data dict

Return type:dict
Returns:the data if succesful, else None
ogt.ags4.doc_to_ags4_csv(doc)[source]

Serialize a document to ags4 format CSV

Parameters:doc (ogt.ogt_doc.OGTDocument) -- The document to convert
Return type:tuple
Returns:
ogt.ags4.group(group_code)[source]

Return all GROUP s in the ags4 data dict

Parameters:group_code (str) -- The four character group code to initialize with
Return type:dict
Returns:the data if successful, else None
ogt.ags4.groups()[source]

Return all GROUP s in the ags4 data dict

Return type:dict
Returns:the data if succesful, else None
ogt.ags4.report_to_string(report)[source]
ogt.ags4.rule_1(doc)[source]

Validate Rule 1 - Character Set

Parameters:raw_str --
Return type:tuple
Returns:
  • A list of ags_errors
  • A list of sys_errors
ogt.ags4.rule_10(doc)[source]

Validate Rule 10 - Validation

Todo

Rule 10 validation

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_2(doc)[source]

Validate Rule 2 - GROUP's required

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_3(doc)[source]

Validate Rule 3 - Data Descriptors

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_4(doc)[source]

Validate Rule 4 - FIELD's

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_5(doc)[source]

Validate Rule 5 - Double Quotes

Todo

Rule 5 validation

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_6(doc)[source]

Validate Rule 6 - Comma Separated

Todo

Rule 6 validation

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_7(doc)[source]

Validate Rule 7 - Field Ordering

Todo

Rule 7 Field ordering

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_8(doc)[source]

Validate Rule 8 - Units

Todo

Rule 8 Units

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.rule_9(doc)[source]

Validate Rule 9 - Data Dictionary

Todo

Rule 9 Data Dictionary

Parameters:doc (OGTDocument) --
Return type:tuple
Returns:
  • a list of ags_errors
  • a list of sys errors
ogt.ags4.run_tests(rules)[source]

Run tests on files in ags4_tests/

Parameters:rules -- A list of test to run eg [7 8 9]. Empty = all
Return type:tuple
Returns:
  • A list of ags errors
  • A list of system errors
ogt.ags4.summary_to_string(summary)[source]
ogt.ags4.validate_ags4_file(file_path, rules=[])[source]