def _write_metrics(self, g, rep, identifier, filing):
        metrics = Metrics(filing['items'])

        for concept_name, function in metrics.get_metrics().items():
            concept = NS['xebr'][concept_name]
            datatype = xebr.graph.value(subject=concept, predicate=NS['rdfs']['range'])
            assert datatype is not None
            value = function()

            if value is not None:
                metric_id = NS['xebr']["%s_%s" % (concept_name, identifier)]
                g.add((metric_id, NS['xebr'][concept_name], Literal(value, datatype=datatype)))
                g.add((rep, NS['xebr']['hasMetric'], metric_id))
Beispiel #2
0
 def setUp(self):
     self.metrics = Metrics({
         'hasOperatingProfitLossTotal': '120.01EUR',
         'hasProfitLossForThePeriodTotal': '243EUR',
         'hasEquityTotal': '7.07EUR',
         'hasOperatingIncomeTotal': '400EUR',
         'hasRawMaterialsAndConsumablesTotal': '31EUR',
         'hasOtherOperatingCharges': '123.45EUR',
         'hasCurrentAssetsTotal': '140.23EUR',
         'hasAmountsPayableWithinOneYearTotal': '17EUR'
     })
Beispiel #3
0
class TestMetrics(unittest.TestCase):

    def setUp(self):
        self.metrics = Metrics({
            'hasOperatingProfitLossTotal': '120.01EUR',
            'hasProfitLossForThePeriodTotal': '243EUR',
            'hasEquityTotal': '7.07EUR',
            'hasOperatingIncomeTotal': '400EUR',
            'hasRawMaterialsAndConsumablesTotal': '31EUR',
            'hasOtherOperatingCharges': '123.45EUR',
            'hasCurrentAssetsTotal': '140.23EUR',
            'hasAmountsPayableWithinOneYearTotal': '17EUR'
        })

    def test_ebit(self):
        self.assertEqual(str(self.metrics.ebit()), '120.01EUR')
    def test_netResult(self):
        self.assertEqual(str(self.metrics.netResult()), '243.00EUR')
    def test_ownFunds(self):
        self.assertEqual(str(self.metrics.ownFunds()), '7.07EUR')
    def test_addedValue(self):
        self.assertEqual(str(self.metrics.addedValue()), '245.55EUR')
    def test_currentRatio(self):
        self.assertEqual(str(self.metrics.currentRatio()), '8.25')
    def test_netWorkingCapital(self):
        self.assertEqual(str(self.metrics.netWorkingCapital()), '123.23EUR')