Skip to content

Commit

Permalink
HXLMeta (#9): started class HXLMeta based on HXLTabConverter (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Feb 7, 2021
1 parent c55b1e2 commit 2b5f73d
Show file tree
Hide file tree
Showing 2 changed files with 242 additions and 90 deletions.
166 changes: 121 additions & 45 deletions bin/hxl2tab
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,70 @@ class HXLTabConverter:
}

}

def __init__(self):
"""
Constructs all the necessary attributes for the HXLTabConverter
object.
"""

# Posix exit codes
self.EXIT_OK = 0
self.EXIT_ERROR = 1
self.EXIT_SYNTAX = 2

def is_tab_file(self):
print("""Please just check if the file use tab as separator outside
this class. For sake of simplicity, the HXLTabConverter assumes
both exported HXL files and imported created outside would be
saved in tab, so no extra checks would be need for Excel or
CSVs""")

def is_tablike_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")

def is_tablike_heading_single(self, header_line):
"""
is_tablike_heading_single ...
"""
print("TODO")

def is_tablike_heading_three(self, header_group):
"""
is_tablike_heading_three ...
"""
print("TODO")

def is_tab_hxlated_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")


class HXLMeta:
"""
HXLMeta is (...)
Author: Multiple Authors
License: Public Domain
Version: v0.2
"""

# Uses HXL v1.1-final
# @see https://hxlstandard.org/standard/1-1final/dictionary/
# @see https://docs.google.com/spreadsheets/d/
# 1En9FlmM8PrbTWgl3UHPF_MXnJ6ziVZFhBbojSJzBdLI/edit#gid=319251406
# @see https://en.wikipedia.org/wiki/Statistical_data_type
HXL_REFERENCE = {
# 'hxl_core_datatypes': [
# 'text', 'number', 'url', 'email', 'phone', 'date'
# ]
'hashtag': {
# access
# activity
Expand All @@ -406,7 +464,9 @@ class HXLTabConverter:
# capacity
# cause
# channel
# contact
# contact | Contact information for the subject of a data record
# (e.g. an activity).
# Since HXL 1.0.
# country
# crisis
# currency
Expand Down Expand Up @@ -491,53 +551,69 @@ class HXLTabConverter:
'value': {
'datatype_hxl': "number"
},
},
'attributes': {
# ### HXL official Core attributes ________________________________
# @see https://docs.google.com/spreadsheets/d/
# 1En9FlmM8PrbTWgl3UHPF_MXnJ6ziVZFhBbojSJzBdLI/edit#gid=1810309357
# +code
'code': {
'datatype_hxl': "text"
},
# +coord
# +dest
# +displaced
# +elevation
# +email (also an HXL Core Data Type)
# +id
# +label
'label': {
'datatype_hxl': "text"
},
# +lat
# +lon
# +name
# +num
'num': {
'datatype_hxl': "number"
},
# +pct
# +phone (also an HXL Core Data Type)
# +start
# +text (also an HXL Core Data Type)
# +type
# +url (also an HXL Core Data Type)
# ### HXL Data Types ______________________________________________
# text
'text': {
'datatype_hxl': "text"
},
# number
'number': {
'datatype_hxl': "number"
},
# url
'url': {
'datatype_hxl': "url",
'dataflag_orange': "meta",
},
# email
'email': {
'datatype_hxl': "email",
'dataflag_orange': "meta",
},
# phone
'phone': {
'datatype_hxl': "phone",
'dataflag_orange': "meta",
},
# date
'date': {
'datatype_hxl': "date"
},
}
}

def __init__(self):
"""
Constructs all the necessary attributes for the HXLTabConverter
object.
"""

# Posix exit codes
self.EXIT_OK = 0
self.EXIT_ERROR = 1
self.EXIT_SYNTAX = 2

def is_tab_file(self):
print("""Please just check if the file use tab as separator outside
this class. For sake of simplicity, the HXLTabConverter assumes
both exported HXL files and imported created outside would be
saved in tab, so no extra checks would be need for Excel or
CSVs""")

def is_tablike_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")

def is_tablike_heading_single(self, header_line):
"""
is_tablike_heading_single ...
"""
print("TODO")

def is_tablike_heading_three(self, header_group):
"""
is_tablike_heading_three ...
"""
print("TODO")

def is_tab_hxlated_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")


class HXLUtils:
"""
Expand Down
166 changes: 121 additions & 45 deletions bin/hxlquickimporttab
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ S for string -> +vt_orange_type_string (for now, just ignore)

return hxlattrs


class HXLTabConverter:
"""
HXLTabConverter is an class to export implement minimum functionality to
Expand Down Expand Up @@ -370,12 +371,69 @@ class HXLTabConverter:

}

def __init__(self):
"""
Constructs all the necessary attributes for the HXLTabConverter
object.
"""

# Posix exit codes
self.EXIT_OK = 0
self.EXIT_ERROR = 1
self.EXIT_SYNTAX = 2

def is_tab_file(self):
print("""Please just check if the file use tab as separator outside
this class. For sake of simplicity, the HXLTabConverter assumes
both exported HXL files and imported created outside would be
saved in tab, so no extra checks would be need for Excel or
CSVs""")

def is_tablike_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")

def is_tablike_heading_single(self, header_line):
"""
is_tablike_heading_single ...
"""
print("TODO")

def is_tablike_heading_three(self, header_group):
"""
is_tablike_heading_three ...
"""
print("TODO")

def is_tab_hxlated_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")


class HXLMeta:
"""
HXLMeta is (...)
Author: Multiple Authors
License: Public Domain
Version: v0.2
"""

# Uses HXL v1.1-final
# @see https://hxlstandard.org/standard/1-1final/dictionary/
# @see https://docs.google.com/spreadsheets/d/
# 1En9FlmM8PrbTWgl3UHPF_MXnJ6ziVZFhBbojSJzBdLI/edit#gid=319251406
# @see https://en.wikipedia.org/wiki/Statistical_data_type
HXL_REFERENCE = {
# 'hxl_core_datatypes': [
# 'text', 'number', 'url', 'email', 'phone', 'date'
# ]
'hashtag': {
# access
# activity
Expand All @@ -394,7 +452,9 @@ class HXLTabConverter:
# capacity
# cause
# channel
# contact
# contact | Contact information for the subject of a data record
# (e.g. an activity).
# Since HXL 1.0.
# country
# crisis
# currency
Expand Down Expand Up @@ -479,53 +539,69 @@ class HXLTabConverter:
'value': {
'datatype_hxl': "number"
},
},
'attributes': {
# ### HXL official Core attributes ________________________________
# @see https://docs.google.com/spreadsheets/d/
# 1En9FlmM8PrbTWgl3UHPF_MXnJ6ziVZFhBbojSJzBdLI/edit#gid=1810309357
# +code
'code': {
'datatype_hxl': "text"
},
# +coord
# +dest
# +displaced
# +elevation
# +email (also an HXL Core Data Type)
# +id
# +label
'label': {
'datatype_hxl': "text"
},
# +lat
# +lon
# +name
# +num
'num': {
'datatype_hxl': "number"
},
# +pct
# +phone (also an HXL Core Data Type)
# +start
# +text (also an HXL Core Data Type)
# +type
# +url (also an HXL Core Data Type)
# ### HXL Data Types ______________________________________________
# text
'text': {
'datatype_hxl': "text"
},
# number
'number': {
'datatype_hxl': "number"
},
# url
'url': {
'datatype_hxl': "url",
'dataflag_orange': "meta",
},
# email
'email': {
'datatype_hxl': "email",
'dataflag_orange': "meta",
},
# phone
'phone': {
'datatype_hxl': "phone",
'dataflag_orange': "meta",
},
# date
'date': {
'datatype_hxl': "date"
},
}
}


def __init__(self):
"""
Constructs all the necessary attributes for the HXLTabConverter
object.
"""

# Posix exit codes
self.EXIT_OK = 0
self.EXIT_ERROR = 1
self.EXIT_SYNTAX = 2

def is_tab_file(self):
print("""Please just check if the file use tab as separator outside
this class. For sake of simplicity, the HXLTabConverter assumes
both exported HXL files and imported created outside would be
saved in tab, so no extra checks would be need for Excel or
CSVs""")

def is_tablike_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")

def is_tablike_heading_single(self, header_line):
"""
is_tablike_heading_single ...
"""
print("TODO")

def is_tablike_heading_three(self, header_group):
"""
is_tablike_heading_three ...
"""
print("TODO")

def is_tab_hxlated_heading(self, header_group):
"""
is_tab_heading can either receive a single list of headings or an group
of 3 lines of headings.
"""
print("TODO")

class HXLUtils:
"""
Expand Down

0 comments on commit 2b5f73d

Please sign in to comment.