What are the correct entities and how to nest them to declare an electricity rate for an electricity provider?
Example:
Provider: John Doe Provider
Rate: John Doe’s Special Electricity Rate
Basefee: 9,90 EUR
Working Price: 0,27 EUR / kWh
Rating: 5 from 5 Stars
I agree with the recommendation of Andrew Morton, however, I would like to clarify some details. To identify kilowatt-hours, I recommend that you use an international identifier from UNECE. E.g.:
"priceSpecification":{
"#type":"UnitPriceSpecification",
"price":"0.27",
"priceCurrency":"EUR",
"referenceQuantity": {
"#type":"QuantitativeValue",
"value":"1",
"unitCode":"KWH",
"sameAs":"http://www.unece.org/fileadmin/DAM/cefact/recommendations/bkup_htm/add3hk.htm"
}
}
In the content of a web page, it may be useful to use the HTML element abbr for an abbreviation of kilowatt-hours
Use the following recommendation for the price property:
Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a
decimal point. Avoid using these symbols as a readability separator.
Update 2019-09-30 related to the following question of JKB:
... But how to extend this example to also declare „base fee“? And, in
addition, set the name of the supplier?
The following markup may probably help you:
{"#context": "http://schema.org/",
"#type":"Service",
"serviceType":"Supply of electricity",
"provider":{
"#type":"LocalBusiness",
"name":"John Doe Provider"
},
"offers":{
"#type":"Offer",
"name":"Base fee",
"price": "9.90",
"priceCurrency": "EUR",
"priceSpecification":{
"#type":"UnitPriceSpecification",
"name":"Working Price",
"price":"0.27",
"priceCurrency":"EUR",
"referenceQuantity": {
"#type":"QuantitativeValue",
"value":"1",
"unitCode":"KWH",
"sameAs":"http://www.unece.org/fileadmin/DAM/cefact/recommendations/bkup_htm/add3hk.htm"
}
}
}
}
I set here the top-level type such as Service however, I do not have a clear understanding of whether this is a service or a product. Therefore you need to clearly determine whether the supply of electricity is a service or is it an intangible product. If this is a product, then adjust this markup for the type Product.
Related
So we are trying to work out in what format do we store money values in MongoDB we are talking dealing with cents.
For example if someone gets charged 0.04 but we take 30% commission we should get 0.012
But I am sure that we should not be storing data like $0.012 or even in 0.012
because technically you could end up with 0.0125 for example.
I read that you should use something like this. trans_amount | decimal | 10 | Deposit amount
Meaning in MongoDB it would be stored like:
{
trans_amount: NumberInit(00125)
}
However the issue is that if $10 was spend it would be store like
{
trans_amount: NumberInit(01000)
}
Now if we go back to the first above example and try to code it out we would get $1.25 instead of the $0.0125 it should be.
Now I am guessing the correct way would be to have 12 digits?
000000000000
However this works up to when you have a customer that wants to spend Trillion dollars at once (not that that would happen - but you never know)
So before I go and code a transaction database I want to work out the correct way to store cents and dollars in MongoDB for accounting.
According to Mongodb they recommend the following:
{
price: { display: "9.99", approx: 9.9900000000000002, currency: "USD" },
fee: { display: "0.25", approx: 0.2499999999999999, currency: "USD" }
}
OR
{ price: 9990, currency: "USD" }
However does approx automatically get done by MongoDB - My guess is no and I would have to work that out myself.
There are couple of ways to do this:
{ price: 9990, currency: "USD" } //See it is not string
As in the above example, you can store. Here the thing is that number of decimals is fixed at any point of time.
The scale factor is consistent for a currency; i.e. same scaling factor for a given currency. The scale factor is a constant and known property of the currency; i.e applications can determine the scale factor from the currency.
In another way, you can use other type:
{
price: { display: "9.99", approx: 9.9900000000000002, currency: "USD" },
fee: { display: "0.25", approx: 0.2499999999999999, currency: "USD" }
}
Here, approx describes exact decimal value with more decimal. The value you query is represented by display field.
In one field, encode the exact monetary value as a non-numeric data type; e.g., BinData or a string. In the second field, store a double-precision floating point approximation of the exact value.
I'm looking for right way to sort my mongodb collection by max values of lendprojectcost fields and exclude documents the value of the field countryname does not contain [East Asia and Pacific,Africa,Pacific Islands].
My code is:
db.collection.find({countryname: {$ne: 'Africa', 'East Asia and Pacific'}, {lendprojectcost: 1}})
But it doesn't work
Sample document
{
"_id":"52b213b38594d8a2be17c780",
"approvalfy":1999,
"board_approval_month":"November",
"boardapprovaldate":"2013-11-12T00:00:00Z",
"borrower":"FEDERAL DEMOCRATIC REPUBLIC OF ETHIOPIA",
"closingdate":"2018-07-07T00:00:00Z",
"country_namecode":"Federal Democratic Republic of Ethiopia!$!ET",
"countrycode":"ET",
"countryname":"Federal Democratic Republic of Ethiopia",
"countryshortname":"Ethiopia",
"docty":"Project Information Document,Indigenous Peoples Plan,Project Information Document",
"envassesmentcategorycode":"C",
"grantamt":0,
"ibrdcommamt":0,
"id":"P129828",
"idacommamt":130000000,
"impagency":"MINISTRY OF EDUCATION",
"lendinginstr":"Investment Project Financing",
"lendinginstrtype":"IN",
"lendprojectcost":550000000,
"majorsector_percent":[
{
"Name":"Education",
"Percent":46
},
{
"Name":"Education",
"Percent":26
},
{
"Name":"Public Administration, Law, and Justice",
"Percent":16
},
{
"Name":"Education",
"Percent":12
}
],
"mjsector_namecode":[
{
"name":"Education",
"code":"EX"
},
{
"name":"Education",
"code":"EX"
},
{
"name":"Public Administration, Law, and Justice",
"code":"BX"
},
{
"name":"Education",
"code":"EX"
}
],
"mjtheme":[
"Human development"
],
"mjtheme_namecode":[
{
"name":"Human development",
"code":"8"
},
{
"name":"",
"code":"11"
}
],
"mjthemecode":"8,11",
"prodline":"PE",
"prodlinetext":"IBRD/IDA",
"productlinetype":"L",
"project_abstract":{
"cdata":"The development objective of the Second Phase of General Education Quality Improvement Project for Ethiopia is to improve learning conditions in primary and secondary schools and strengthen institutions at different levels of educational administration. The project has six components. The first component is curriculum, textbooks, assessment, examinations, and inspection. This component will support improvement of learning conditions in grades KG-12 by providing increased access to teaching and learning materials and through improvements to the curriculum by assessing the strengths and weaknesses of the current curriculum. This component has following four sub-components: (i) curriculum reform and implementation; (ii) teaching and learning materials; (iii) assessment and examinations; and (iv) inspection. The second component is teacher development program (TDP). This component will support improvements in learning conditions in both primary and secondary schools by advancing the quality of teaching in general education through: (a) enhancing the training of pre-service teachers in teacher education institutions; and (b) improving the quality of in-service teacher training. This component has following three sub-components: (i) pre-service teacher training; (ii) in-service teacher training; and (iii) licensing and relicensing of teachers and school leaders. The third component is school improvement plan. This component will support the strengthening of school planning in order to improve learning outcomes, and to partly fund the school improvement plans through school grants. It has following two sub-components: (i) school improvement plan; and (ii) school grants. The fourth component is management and capacity building, including education management information systems (EMIS). This component will support management and capacity building aspect of the project. This component has following three sub-components: (i) capacity building for education planning and management; (ii) capacity building for school planning and management; and (iii) EMIS. The fifth component is improving the quality of learning and teaching in secondary schools and universities through the use of information and communications technology (ICT). It has following five sub-components: (i) national policy and institution for ICT in general education; (ii) national ICT infrastructure improvement plan for general education; (iii) develop an integrated monitoring, evaluation, and learning system specifically for the ICT component; (iv) teacher professional development in the use of ICT; and (v) provision of limited number of e-Braille display readers with the possibility to scale up to all secondary education schools based on the successful implementation and usage of the readers. The sixth component is program coordination, monitoring and evaluation, and communication. It will support institutional strengthening by developing capacities in all aspects of program coordination, monitoring and evaluation; a new sub-component on communications will support information sharing for better management and accountability. It has following three sub-components: (i) program coordination; (ii) monitoring and evaluation (M and E); and (iii) communication."
},
"project_name":"Ethiopia General Education Quality Improvement Project II",
"projectdocs":[
{
"DocTypeDesc":"Project Information Document (PID), Vol.",
"DocType":"PID",
"EntityID":"090224b081e545fb_1_0",
"DocURL":"http://www-wds.worldbank.org/servlet/WDSServlet?pcont=details&eid=090224b081e545fb_1_0",
"DocDate":"28-AUG-2013"
},
{
"DocTypeDesc":"Indigenous Peoples Plan (IP), Vol.1 of 1",
"DocType":"IP",
"EntityID":"000442464_20130920111729",
"DocURL":"http://www-wds.worldbank.org/servlet/WDSServlet?pcont=details&eid=000442464_20130920111729",
"DocDate":"01-JUL-2013"
},
{
"DocTypeDesc":"Project Information Document (PID), Vol.",
"DocType":"PID",
"EntityID":"090224b0817b19e2_1_0",
"DocURL":"http://www-wds.worldbank.org/servlet/WDSServlet?pcont=details&eid=090224b0817b19e2_1_0",
"DocDate":"22-NOV-2012"
}
],
"projectfinancialtype":"IDA",
"projectstatusdisplay":"Active",
"regionname":"Africa",
"sector":[
{
"Name":"Primary education"
},
{
"Name":"Secondary education"
},
{
"Name":"Public administration- Other social services"
},
{
"Name":"Tertiary education"
}
],
"sector1":{
"Name":"Primary education",
"Percent":46
},
"sector2":{
"Name":"Secondary education",
"Percent":26
},
"sector3":{
"Name":"Public administration- Other social services",
"Percent":16
},
"sector4":{
"Name":"Tertiary education",
"Percent":12
},
"sector_namecode":[
{
"name":"Primary education",
"code":"EP"
},
{
"name":"Secondary education",
"code":"ES"
},
{
"name":"Public administration- Other social services",
"code":"BS"
},
{
"name":"Tertiary education",
"code":"ET"
}
],
"sectorcode":"ET,BS,ES,EP",
"source":"IBRD",
"status":"Active",
"supplementprojectflg":"N",
"theme1":{
"Name":"Education for all",
"Percent":100
},
"theme_namecode":[
{
"name":"Education for all",
"code":"65"
}
],
"themecode":"65",
"totalamt":130000000,
"totalcommamt":130000000,
"url":"http://www.worldbank.org/projects/P129828/ethiopia-general-education-quality-improvement-project-ii?lang=en"
}
You can use $nin when you want to specify which values should not be returned for particular field:
db.collection.find({countryname: {$nin: ["Africa", "East Asia and Pacific"]}}).sort({lendprojectcost: -1})
If you want to sort by lendprojectcost in descending order (max value first) then you should use sort with -1 value
I queried an Invoice that contains a billable expense charge. The response includes (and I'm showing just the relevant portions of it):
....
"Line": [
{
"LineNum": 1,
"DescriptionLineDetail": {
"ServiceDate": "2015-11-15"
},
"Id": "3",
"DetailType": "DescriptionOnly",
"Description": "Test Billable Transaction 1"
},
{
"LineNum": 2,
"DescriptionLineDetail": {
"ServiceDate": "2015-11-15"
},
"Id": "4",
"DetailType": "DescriptionOnly",
"Description": "Test Billable Expense Transaction 3"
},
{
"DetailType": "SubTotalLineDetail",
"Amount": 8.01,
"SubTotalLineDetail": {}
}
],
"LinkedTxn": [
{
"TxnId": "1938",
"TxnType": "ReimburseCharge"
},
{
"TxnId": "1932",
"TxnType": "ReimburseCharge"
}
],
...
I tried querying the API for ReimburseCharge and got only errors back. Is this business object on the roadmap?
On a related note, I observe that a billable line (at least in Purchase objects) can have its BillableStatus attribute set to "HasBeenBilled" with an Update call. It cannot be set back to "Billable" without first setting it to "NotBillable", but this does seem to work more than once so that it's not a one-way effect. If the line has actually been billed though, I get a validation fault when I try to change the BillableStatus from "HasBeenBilled" to "NotBillable", which I suppose makes sense.
Here's what's decidedly problematic though: I cannot use the API to either link a billable expense to an invoice or figure out where an already-linked expense is invoiced. Also, I cannot see the amount of the individual lines contained in these "DescriptionOnly" lines, so all I get is the total. Does Intuit have plans to change this and, if so, when?
This decision for supporting Reimb Charge is still pending.
Regarding DescriptionOnly- This was meant to support only total and sub totals.
So, if you have to use lines then you should use SalesItemLineDetail
I have run into a strange problem with the groupBy and sum methods when used with populate. I have a set of associated models: User, Source (books, etc), Recommendation, and Discipline (i.e. academic discipline).
I attempted the following waterline query:
Recommendation.find({
where: {discipline: '5559ea07dfa9bd0499f9f799'},
groupBy: ['source'], sum: ['rating']
}).exec(console.log);
This worked well, returning:
[
{
"source": "5571e72ab50f0c3c49fe19f6",
"rating": 4
},
{
"source": "5571b88c51861950360fac1c",
"rating": 12
}
]
I then tried it with populate on the source because I wanted to have the full source data linked to the each recommendation. So I tried:
Recommendation.find({
where: {discipline: '5559ea07dfa9bd0499f9f799'},
groupBy: ['source'], sum: ['rating']
}).populate('source').exec(console.log);
This yielded something strange:
[
{
"source": {
"type": "book",
"identifiers": [
{
"type": "ISBN_10",
"identifier": "1400823226"
},
{
"type": "ISBN_13",
"identifier": "9781400823222"
}
],
"title": "Patterns for America",
"subtitle": "Modernism and the Concept of Culture",
"publisher": "Princeton University Press",
"year": 1999,
"language": "en",
"categories": [
"Literary Criticism"
],
"abstract": "In recent decades, historians and social theorists have given much thought to the concept of \"culture,\" its origins in Western thought, and its usefulness for social analysis. In this book, Susan Hegeman focuses on the term's history in the United States in the first half of the twentieth century. She shows how, during this period, the term \"culture\" changed from being a technical term associated primarily with anthropology into a term of popular usage. She shows the connections between this movement of \"culture\" into the mainstream and the emergence of a distinctive \"American culture,\" with its own patterns, values, and beliefs. Hegeman points to the significant similarities between the conceptions of culture produced by anthropologists Franz Boas, Edward Sapir, Ruth Benedict, and Margaret Mead, and a diversity of other intellectuals, including Randolph Bourne, Van Wyck Brooks, Waldo Frank, and Dwight Macdonald. Hegeman reveals how relativist anthropological ideas of human culture--which stressed the distance between modern centers and \"primitive\" peripheries--came into alliance with the evaluating judgments of artists and critics. This anthropological conception provided a spatial awareness that helped develop the notion of a specifically American \"culture.\" She also shows the connections between this new view of \"culture\" and the artistic work of the period by, among others, Sherwood Anderson, Jean Toomer, Thomas Hart Benton, Nathanael West, and James Agee and depicts in a new way the richness and complexity of the modernist milieu in the United States.",
"imageLinks": {
"smallThumbnail": "http://bks3.books.google.de/books/content?id=OwYWU2H3me4C&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api",
"thumbnail": "http://bks3.books.google.de/books/content?id=OwYWU2H3me4C&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
},
"createdAt": "2015-06-05T14:56:12.714Z",
"updatedAt": "2015-06-05T14:56:12.724Z",
"id": "5571b88c51861950360fac1c"
},
"rating": 4
},
{
"source": {
"_bsontype": "ObjectID",
"id": "Uq¸Q\u0019P6\u000f¬\u001c"
},
"rating": 12
}
]
As you can see rather than replacing the source id with the full source properties, it added the source as an object in the returned array, and then added another object with a new source id reference, and the summed rating amount. Strangely, it also attached just one of the rating values to the source object it appended to the results.
Is this what should be happening. I can't follow the logic and it feels a bit buggy. In any case, what I would like is to have the source within each returned row, alongside the summed total. Can anyone explain what's going on here, and if I made an error perhaps?
Hi i'm still new in Facebook-ads-api I know this is a noob question,
I want to get the audience_size for the Interest in a specific country.
on the API sample it can only generate the whole world audience_size of an Interest
use FacebookAds\Object\TargetingSearch;
use FacebookAds\Object\Search\TargetingSearchTypes;
$results = TargetingSearch::search(
TargetingSearchTypes::INTEREST,
null,
'soccer'
);
// Sample Response
{
"data":[
{
"name":"Association football (Soccer)",
"id":6003107902433,
"audience_size":593326800,
"path":[
"Sports and outdoors",
"Sports",
"Association football (Soccer)"
],
"description":null
},
...other results...
]
}
In order to get the estimated audience, you can use the Reach Estimate.
You can see the documentation here: https://developers.facebook.com/docs/marketing-api/reference/ad-account/reachestimate/
Just pass the targeting object (which include the interest and the country) and get the result.