• Logout
<div class="notebook">

<div class="nb-cell markdown" name="md1">
# Power User Tool
</div>

<div class="nb-cell markdown" name="md2">
To submit a report to Pacioli and obtain its analysis use ``checkReport3(ReportURL,ExtraResources,Options,ResultLink)``:
</div>

<div class="nb-cell query" name="q1">
checkReport3("http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/reference-implementation/instance.xml", 
['http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/disclosure-mechanics/disclosure-mechanics.xsd','http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/reporting-checklist/reporting-checklist-rules-def.xml'], [valueAssertionsCanDerive,autoloadReportingStyle,cacheValidity(3600)], 
Result).
</div>

<div class="nb-cell markdown" name="md3">
To obtain Options, submit the financial report first via the main submission form, and copy the resulting *Options* list, under User Alterations at the top of the Pacioli report.

In the above example, that would be ``[valueAssertionsCanDerive, autoloadReportingStyle, cacheValidity(3600)]``.

ExtraResources`can be empty: ``[]``
</div>

<div class="nb-cell markdown" name="md3">
NOTE about **saveToIPFS**: this generates an IPFS web link in the last argument, navigating to an IPFS copy of the Pacioli report and all XBRL resources used; this takes **LONGER**, so you may want to remove this option unless you need it.

To obtain Options, submit the financial report first via the main submission form, and copy the resulting *Options* list, under User Alterations at the top of the Pacioli report.

In the above example, that would be ``[valueAssertionsCanDerive, autoloadReportingStyle, cacheValidity(3600)]``.

Another option of interest: *definitionGraphs*, causes rendering of the definition links as a graph for each report network.

ExtraResources`can be empty: ``[]``
</div>

<div class="nb-cell markdown" name="md11">
## Simpler to run

In alternative to the above text field, you can use this to popup a dialog and fill each field separately:
</div>

<div class="nb-cell query" name="q3">
projection([Result,IPFS]),
parameters([Report: string+label('Report to analyze:'),
R1:string+label('Resource 1:')+default(''),R2:string+label('Resource 2:')+default(''),R3:string+label('Resource 3:')+default(''),
Options_:string+label('Options:')+default('[valueAssertionsCanDerive,saveToIPFS,extendedJSON,auditchainTestUI]')]), 
joinIntoList(R1,R2,R3,ExtraResources), term_string(Options,Options_),
checkReport3(Report, ExtraResources, Options, Result, IPFS).
</div>

<div class="nb-cell markdown" name="md8">
## Seeing analysis via Auditchain's standard UI

For that one needs to use two extra options, ```auditchainTestUI``` and ``èxtendedJSON```:
</div>

<div class="nb-cell query" name="q4">
checkReport3("http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/reference-implementation/instance.xml", 
['http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/disclosure-mechanics/disclosure-mechanics.xsd','http://xbrlsite.azurewebsites.net/2021/reporting-scheme/proof/reporting-checklist/reporting-checklist-rules-def.xml'], [valueAssertionsCanDerive,saveToIPFS,extendedJSON,auditchainTestUI,cacheValidity(3600)], 
Result,IPFSlink).
</div>

<div class="nb-cell markdown" name="md9">
The link to the Auditchain UI will appear in the Result variable. That UI may take s bit longer to load, due to IPFS file propagation delays.
</div>

<div class="nb-cell markdown" name="md4">
## Altering facts and rules

Next is an example "patching"the report, e.g. adding user alterations to it via the patches(...) option:
</div>

<div class="nb-cell query" name="q2">
checkReport3("http://www.xbrlsite.com/2021/testing/proof/report/instance.xml", 
['http://www.xbrlsite.com/2021/testing/proof/fac/PROOF-BSC-IS01-CF1_schema.xsd'], 
[newRulesFormat,removePrecondFallbacks,removeValueAssertionFallbacks,renderFAConly, 
patches([
- fact_(self,fac:'Assets','I-2020','U-Monetary-USD',_,_,_), 
fact_(self,fac:'Assets','I-2020','U-Monetary-USD',null,'INF',9999),
fact_(self,fac:'Assets','I-2018','U-Monetary-USD',null,'INF',1313), 
context(self,'I-2018',entity('http://standards.iso.org/iso/17442','GH259400TOMPUOLS65II'),null,instant('2018-12-31'))
])], 
Result).
</div>

<div class="nb-cell markdown" name="md5">
Notice the MINUS sign on the first fact, it means "delete". And also the special report URL 'self', which means... the current report.

So the above example, in order:

* deletes a reported fact
* overrides it with a bogus (9999) fact
* adds a weird fact for a nonexistent context
* adds that new context
</div>

<div class="nb-cell markdown" name="md6">
This works and may be useful to put together sequences of variations on a single report on a notebook, but pls beware that it is brittle, namely:

- careful with quotes
- go to any ReportAndModel.pl file for inspiration and copy/paste Prolog facts from there into patch lists such as above; theoretically, any will work
- fact_ is special, in that the relation you see in any ReportAndModel.pl has an extra hash argument (for indexing, nothing to do with the blockchain hash); for convenience that argument is to be omitted above
</div>

<div class="nb-cell markdown" name="md10">
## Available options in Pacioli

The following options are available:

```eval
:-xbrl:pacioliOptions(Options), format("&lt;ul&gt;"), 
    forall((member(O,Options),pacioliOptionDoc(O,Doc)), format("&lt;li&gt;~w:&lt;br/&gt; &lt;i&gt;~a&lt;/i&gt;&lt;/li&gt;",[O,Doc]) ), 
    format("&lt;/ul&gt;").
```

These are deprecated or experimental:

```eval
:-xbrl:pacioliOptions(Options), format("&lt;ul&gt;"), 
    forall((member(O,Options), \+ pacioliOptionDoc(O,_)), format("&lt;li&gt;~w&lt;/li&gt;",[O])), 
    format("&lt;/ul&gt;").
```
</div>

<div class="nb-cell markdown" name="md7">
## Pacioli nmodel relations

Every Pacioli report produced with option```extendedJSON``` includes a /ReportAndModel.pl.gzip compressed PROLOG file with these relations:

```eval
:-format("&lt;ul&gt;"), 
    forall(relationDocHTML(Doc), writeln(Doc) ), 
    format("&lt;/ul&gt;").
```
</div>

<div class="nb-cell program" data-background="true" data-singleline="true" name="p1">
joinIntoList(A,B,C,L) :-
    ((A=="";A=='') -&gt;   AL=[] ; AL=[A]),
    ((B=="";B=='') -&gt;   BL=[] ; BL=[B]),
    ((C=="";C=='') -&gt;   CL=[] ; CL=[C]),
    append([AL,BL,CL],L).

    
</div>

</div>