Example #1
0
def label_serializer(serializer):
	filing = serializer.filing
	date = filing.date
	company = filing.company
	nsmap = gen_nsmap(filing, 'Label')
	maker = ElementMaker(nsmap=nsmap)

	with xml_namespace(maker, 'link', auto_convert=True) as maker:
		linkbase = maker.linkbase(**{
			#find out about this
			'xsi:schemaLocation': 'http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd'
		})
		labellink = maker.labelLink(**{
			'xlink:type': 'extended',
			'xlink:role': 'http://www.xbrl.org/2003/role/link',
		})
		
		locs = set([])
		for (fact, unit), context, data in filing.data_stream:
			if fact.href not in locs:
				labellink.append(make_loc(fact, maker, namespace='link'))
				locs.add(fact.href)

		facts = set([])
		for (fact, unit), context, data in filing.data_stream:
			if (fact, unit) in facts:
				continue
			
			facts.add((fact, unit))
			utitle = 'label_{0}_{1}'.format(fact.title, uid())
			labellink.append(make_label(fact, maker, utitle, namespace='link'))
			labellink.append(make_labelArc(fact, maker, utitle, namespace='link'))

		linkbase.append(labellink)

	return linkbase
Example #2
0
	def title(self):
		return uid()
Example #3
0
	def href(self):
		return uid()
Example #4
0
	def label_text(self):
		return uid()
Example #5
0
	def label(self):
		return uid()
Example #6
0
	def id(self):
		return uid()