Giter VIP home page Giter VIP logo

Comments (2)

 avatar commented on June 4, 2024

The issue I have found is that some ElementIds do not have an endDate. From a financial reporting perspective, the company ends their accounting year i.e on Dec31, but does not publically report for a couple more months. An elementID that is reported on the day they release their earnings is another commonSharesOutstanding & companyEntityFloat...these elementIds do not have a normal cycle of startDate and endDate (amongst others) and cause that error.

I appreciate any other insight running & .

from finstr.

bergant avatar bergant commented on June 4, 2024

In xbrl instance there can be many statements with different dimensions. finstr simplified this by excluding statements with missing elements. In this case some elements were missing (GainLossOnSaleOfPropertyPlantEquipment in 2015 and IncreaseDecreaseInDeferredIncomeTaxes in 2014).

I updated finstr::xbrl_get_statement function by additional arguments:

  • complete_only (if true, only complete statements are reported - same functionality as before)
  • complete_first (if true, statements with missing first element is not included - recomended here)

Note: both arguments are TRUE by default. You have to set complete_only to FALSE to use complete_first.

Example:

library(XBRL)
xbrl_urltest <- "http://www.sec.gov/Archives/edgar/data/73290/000151316216000678/bmra-20151130.xml"
old_o <- options(stringsAsFactors = FALSE)
xbrl_test <- xbrlDoAll(xbrl_urltest)
options(old_o)

library(finstr)
sttest <- xbrl_get_statements(xbrl_test, complete_only = FALSE)
sttest$ConsolidatedCashFlow

# Financial statement: 2 observations from 2014-11-30 to 2015-11-30 
#  Element                                                    2015-11-30 2014-11-30
#  CashAndCashEquivalentsPeriodIncreaseDecrease =             -445329     164923   
#  + NetCashProvidedByUsedInOperatingActivities =             -425042     183996   
#    + NetIncomeLoss                                          -139103    -457296   
#    + DepreciationAndAmortization                             116396     126176   
#    + StockOptionPlanExpense                                    2562       1804   
#    + ProvisionForDoubtfulAccounts                             -8653     -16659   
#    + InventoryLIFOReservePeriodCharge                          4216       7423   
#    + bmra_IncreaseDecreaseInDeferredRentLiability            -13072      -9262   
#    + IncreaseDecreaseInAccountsPayableAndAccruedLiabilities  -63233     -88082   
#    + IncreaseDecreaseInEmployeeRelatedLiabilities             21459       8491   
#    + GainLossOnSaleOfPropertyPlantEquipment                      NA        665   
#    + IncreaseDecreaseInDeferredIncomeTaxes                   129000         NA   
#    + IncreaseDecreaseInAccountsReceivable                     52362    -900454   
#    + IncreaseDecreaseInInventories                           214238     231601   
#    + IncreaseDecreaseInPrepaidDeferredExpenseAndOtherAssets  -49986      56787   
#  + NetCashProvidedByUsedInInvestingActivities =              -29219     -20890   
#    + ProceedsFromSaleOfPropertyPlantAndEquipment                 NA       1900   
#    + PaymentsToAcquirePropertyPlantAndEquipment               28294       8654   
#    + PaymentsToAcquireIntangibleAssets                          925      14136   
#  + NetCashProvidedByUsedInFinancingActivities =               10298       3495   
#    + ProceedsFromStockOptionsExercised                        10298       3495   
#  + EffectOfExchangeRateOnCashAndCashEquivalents               -1366      -1678 

Duplicated period warning is also removed (it is OK for XBRL instance to include more than one period with the same endDate). If more than one end date is present, the statement will display context id labels instead of end date. There are no changes in object structure (end date is still a column of the resulting statement data frame).

In this case the contexts of sttest$ConsolidatedIncomeStatement are:

c1_From1Jun2014To30Nov2014
c3_From1Sep2014To30Nov2014
c0_From1Jun2015To30Nov2015
c2_From1Sep2015To30Nov2015

You can filter statements for example by end date:

sttest$ConsolidatedIncomeStatement[
  sttest$ConsolidatedIncomeStatement$endDate == "2015-11-30", ]

# Financial statement: 2 observations from 2015-11-30 to 2015-11-30 
#  Element                                            c2_From1Sep2015To30Nov2015 c0_From1Jun2015To30Nov2015
#  ComprehensiveIncomeNetOfTax =                       -67791                    -140469                   
#  + NetIncomeLoss =                                   -66768                    -139103                   
#    + IncomeLossFromContinuingOperationsBefore... =  -195768                    -268103                   
#      + OperatingIncomeLoss =                        -209774                    -286007                   
#        + GrossProfit =                               412041                     833462                   
#          + SalesRevenueNet                          1165080                    2452073                   
#          + CostOfRevenue                             753039                    1618611                   
#        + OperatingExpenses =                         621815                    1119469                   
#          + SellingGeneralAndAdministrativeExpense    391603                     731263                   
#          + ResearchAndDevelopmentExpense             230212                     388206                   
#      + NonoperatingIncomeExpense =                    14006                      17904                   
#        + InvestmentIncomeInterestAndDividend          14024                      17958                   
#        + InterestExpense                                 18                         54                   
#    + IncomeTaxExpenseBenefit                        -129000                    -129000                   
#  + OtherComprehensiveIncomeForeignCurrencyT...        -1023                      -1366

(SHA: fda9679)

from finstr.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.