Skip to content

Commit

Permalink
Merge branch 'pyoblibupdates' of https://github.com/joelebwf/obtv
Browse files Browse the repository at this point in the history
  • Loading branch information
joelebwf committed Jan 16, 2020
2 parents 4285af5 + 53a94af commit ca2a1f5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
58 changes: 23 additions & 35 deletions viewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,26 +177,11 @@ def entrypoints():
"""Flask Read Handler for entrypoints API endpoint"""

data = []
for ep in tax.semantic.get_all_entrypoints():
t = ""
if ep in ["AssetManager", "Developer", "Entity", "FinanicalPerformance", "Fund", "Insurance",
"OperationalPerformance", "OperationsManager", "Portfolio", "Project", "Site", "Sponsor",
"System", "SystemDeviceListing", "Utility"]:
t = "Data"
elif ep == "ProjectFinancing":
t = "Process"
else:
t = "Document"
description = "This schema contains the entry point for the " + ep

concepts = tax.semantic.get_entrypoint_concepts(ep)
if len(concepts) > 0:
description = tax.documentation.get_concept_documentation(concepts[0])

for item in tax.semantic.get_all_entrypoints(details=True)[1].items():
data.append({
"entrypoint": ep,
"type": t,
"description": description
"entrypoint": item[1].name,
"type": item[1].entrypoint_type.value,
"description": item[1].description
})

return jsonify(data)
Expand Down Expand Up @@ -268,17 +253,9 @@ def concept_detail(concept, taxonomy):
else:
precision_decimals= "N/A (neither precision nor decimals may be specified)"

units = []
if details.type_name.startswith("num:") or details.type_name.startswith("num-us:"):
if details.type_name in ["num:percentItemType"]:
units.append("pure")
else:
for unit in tax.units.get_all_units():
ud = tax.units.get_unit(unit)
if details.type_name.lower().find(ud.item_type.lower()) != -1:
units.append(ud.unit_name)
else:
units.append("N/A (units may not be specified)</li>\n")
units = tax.get_concept_units(concept)
if not units:
units = ["N/A (units are not specified)"]

period = details.period_type.value
if period == "instant":
Expand All @@ -287,11 +264,21 @@ def concept_detail(concept, taxonomy):
period = "Period of time"
nillable = details.nillable

# TODO: Either find out how to calculate this or remove Calculations
if concept == "us-gaap:Revenues":
calc = "Other Income + RebateRevenue + PeformanceBasedIncentiveRevenue + Electrical Generation Revenue = Revenues"
calculations = tax.semantic.get_concept_calculation(concept)
if len(calculations)==0:
calc = ["N/A"]
else:
calc = "N/A"
calc = []
for calculation in calculations:
if calculation[1] == 1:
sign = "+"
else:
sign = "-"
calc.append(sign + " " + calculation[0])

usages = tax.semantic.get_concept_calculated_usage(concept)
if len(usages) == 0:
usages = ["None"]

data = {
"label": label,
Expand All @@ -304,7 +291,8 @@ def concept_detail(concept, taxonomy):
"units": units,
"period": period,
"nillable": nillable,
"calculations": calc
"calculations": calc,
"usages": usages
}

return jsonify(data)
Expand Down
14 changes: 13 additions & 1 deletion web/src/components/ConceptDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@
</ul>
Period: {{ apiData.period }} <br/>
Nillable: {{ apiData.nillable }} <br/>
Calculations: {{ apiData.calculations }} <br/>
Calculations:
<ul>
<li v-for="item in apiData.calculations">
{{ item }}
</li>
</ul>
Usages in Calculations:
<ul>
<li v-for="item in apiData.usages">
{{ item }}
</li>
</ul>

</form>
</div>
</template>
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/EntrypointList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export default {
let tableData = this.$store.state.apiData.filter( node => {
return node.entrypoint.toLowerCase().includes(this.$store.state.searchTerm.toLowerCase()) &&
((node.type.toLowerCase()=="data" && this.$store.state.chkData) ||
(node.type.toLowerCase()=="document" && this.$store.state.chkDocuments) ||
(node.type.toLowerCase()=="documents" && this.$store.state.chkDocuments) ||
(node.type.toLowerCase()=="process" && this.$store.state.chkProcess) ||
(node.type.toLowerCase()=="data" && !this.$store.state.actvChk) ||
(node.type.toLowerCase()=="document" && !this.$store.state.actvChk) ||
(node.type.toLowerCase()=="documents" && !this.$store.state.actvChk) ||
(node.type.toLowerCase()=="process" && !this.$store.state.actvChk))
});
this.numOfElem = 100
Expand Down

0 comments on commit ca2a1f5

Please sign in to comment.