-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added bills dataservice #8
Conversation
Amazing! |
…vice - work in progress
("name", KnessetDataServiceSimpleField('Name', "string", "bill heb name")), | ||
("type_id", KnessetDataServiceSimpleField('SubTypeID', "integer", "type id of the bill")), | ||
("type_description", | ||
KnessetDataServiceSimpleField('SubTypeDesc', "string", "type description of the bill")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new knesset API have a lot of these fields where you have somethingID and related somethingDesc
worth to create a new KnessetDataServiceField class which will handle it automatically -
so instead of defining those two fields, you would define only 1 field:
("type", KnessetDataServiceIdDescriptionField("SubType", "type of the bill"))
behind the scenes this field can expose a python tuple of (id, description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be handled in #13
("num", KnessetDataServiceSimpleField('Number', "Integer",)), | ||
("postponent_reason_id", KnessetDataServiceSimpleField('PostponementReasonID', | ||
"Integer",)), | ||
("postponent_reason_desc", KnessetDataServiceSimpleField('PostponementReasonDesc', "string",)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is another example of the joined Id/desc field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be handled in #13
("type_description", | ||
KnessetDataServiceSimpleField('SubTypeDesc', "string", "type description of the bill")), | ||
("private_num", KnessetDataServiceSimpleField('PrivateNumber', "integer",)), | ||
("committee_id", KnessetDataServiceSimpleField('CommitteeID', "integer",)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this id field is related to Committee object
for this case you can add a helper method on your object which will try to fetch the related committe
something like this:
def get_committee(self):
return Committee.get(self.committee_id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's worth to create a new class for this type of fields
something like:
("committee", KnessetdataServiceRelatedField("CommitteeID", dataservice_class=Committee))
which will handle it automatically
but need to make sure by default it doesn't fetch the related object - only when user requests it
so I'm not sure what's the best way to implement it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the get_committee function will be done
regarding the field type, will be done in #14
I will take all the points that you mentioned into my consideration
…On Sat, Apr 1, 2017 at 1:36 PM, Ori Hoch ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In knesset_data/dataservice/bills.py
<#8 (comment)>
:
> +)
+import constants
+
+
+class Bill(BaseKnessetDataServiceCollectionObject):
+ SERVICE_NAME = "api"
+ METHOD_NAME = "KNS_Bill"
+ ORDERED_FIELDS = [
+ ("id", KnessetDataServiceSimpleField('BillID', "integer", "the primary key")),
+ ("kns_num", KnessetDataServiceSimpleField('KnessetNum', "integer", "kneset number")),
+ ("name", KnessetDataServiceSimpleField('Name', "string", "bill heb name")),
+ ("type_id", KnessetDataServiceSimpleField('SubTypeID', "integer", "type id of the bill")),
+ ("type_description",
+ KnessetDataServiceSimpleField('SubTypeDesc', "string", "type description of the bill")),
+ ("private_num", KnessetDataServiceSimpleField('PrivateNumber', "integer",)),
+ ("committee_id", KnessetDataServiceSimpleField('CommitteeID', "integer",)),
maybe it's worth to create a new class for this type of fields
something like:
("committee", KnessetdataServiceRelatedField("CommitteeID",
dataservice_class=Committee))
which will handle it automatically
but need to make sure by default it doesn't fetch the related object -
only when user requests it
so I'm not sure what's the best way to implement it..
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALLijYV8VlNJ9_XfNKniX6UrRjqdIuQpks5rriirgaJpZM4Mvc8c>
.
|
…into add-bills-dataservice
No description provided.