Reference¶
Registry¶
-
class
iatikit.data.registry.
Registry
(path=None)[source]¶ Class representing the IATI registry.
-
activities
¶ Return an iterator of all IATI activities on the registry.
-
datasets
¶ Return an iterator of all IATI datasets on the registry.
-
last_updated
¶ Return the datetime when the local cache was last updated.
-
organisations
¶ Return an iterator of all IATI organisations on the registry.
-
publishers
¶ Return an iterator of all publishers on the registry.
-
PublisherSet¶
-
class
iatikit.data.publisher.
PublisherSet
(data_path, metadata_path, **kwargs)[source]¶ Class representing a grouping of
Publisher
objects.Objects in this grouping can be filtered and iterated over. Queries are only constructed and run when needed, so they can be efficient.
-
all
()¶ Return a list of all items in this set.
-
count
()¶ The number of items in this set.
Equivalent to
len(self)
.
-
filter
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.Alias of
where(**kwargs)
.
-
find
(**kwargs)¶ Return the first matching item from the set, according to the filters provided in
kwargs
.If no matching item is found, an
IndexError
is raised.
-
first
()¶ Return the first item in this set.
Raises an
IndexError
if the set contains zero items.Equivalent to
self[0]
.
-
get
(item, default=None)¶ Return an item from the set, according to the primary key.
If no matching item is found,
default
is returned.
-
where
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.
-
Publisher¶
-
class
iatikit.data.publisher.
Publisher
(data_path, metadata_path, metadata_filepath)[source]¶ Class representing an IATI publisher.
-
activities
¶ Return an iterator of all activities for this publisher.
-
datasets
¶ Return an iterator of all datasets for this publisher.
-
metadata
¶ Return a dictionary of registry metadata for this publisher.
-
name
¶ Return the “registry name” or “shortname” of this publisher, derived from the filepath.
-
organisations
¶ Return an iterator of all organisations for this publisher.
-
DatasetSet¶
-
class
iatikit.data.dataset.
DatasetSet
(data_path, metadata_path, **kwargs)[source]¶ Class representing a grouping of
Dataset
objects.Objects in this grouping can be filtered and iterated over. Queries are only constructed and run when needed, so they can be efficient.
-
all
()¶ Return a list of all items in this set.
-
count
()¶ The number of items in this set.
Equivalent to
len(self)
.
-
filter
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.Alias of
where(**kwargs)
.
-
find
(**kwargs)¶ Return the first matching item from the set, according to the filters provided in
kwargs
.If no matching item is found, an
IndexError
is raised.
-
first
()¶ Return the first item in this set.
Raises an
IndexError
if the set contains zero items.Equivalent to
self[0]
.
-
get
(item, default=None)¶ Return an item from the set, according to the primary key.
If no matching item is found,
default
is returned.
-
where
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.
-
Dataset¶
-
class
iatikit.data.dataset.
Dataset
(data_path, metadata_path=None)[source]¶ Class representing an IATI dataset.
-
activities
¶ Return an iterator of all activities in this dataset.
-
etree
¶ Return the XML of this dataset, as an lxml element tree.
-
filetype
¶ Return the filetype according to the metadata (i.e. “activity” or “organisation”).
If it can’t be found in the metadata, revert to using the XML root node.
Returns None if the filetype can’t be determined.
-
metadata
¶ Return a dictionary of registry metadata for this dataset.
-
name
¶ Return the name of this dataset, derived from the filename.
-
organisations
¶ Return an iterator of all organisations in this dataset.
-
raw_xml
¶ Return the raw, unparsed XML of this dataset, as a byte-string.
-
root
¶ Return the name of the XML root node.
-
schema
¶ Get the XSD Schema for this dataset.
-
version
¶ Return the IATI version according to the XML root node.
Return “1.01” if the version can’t be determined.
-
xml
¶ Return the parsed XML of this dataset, as a byte-string.
-
ActivitySet¶
-
class
iatikit.data.activity.
ActivitySet
(datasets, **kwargs)[source]¶ Class representing a grouping of
Activity
objects.Objects in this grouping can be filtered and iterated over. Queries are only constructed and run when needed, so they can be efficient.
-
all
()¶ Return a list of all items in this set.
-
count
()¶ The number of items in this set.
Equivalent to
len(self)
.
-
filter
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.Alias of
where(**kwargs)
.
-
find
(**kwargs)¶ Return the first matching item from the set, according to the filters provided in
kwargs
.If no matching item is found, an
IndexError
is raised.
-
first
()¶ Return the first item in this set.
Raises an
IndexError
if the set contains zero items.Equivalent to
self[0]
.
-
get
(item, default=None)¶ Return an item from the set, according to the primary key.
If no matching item is found,
default
is returned.
-
where
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.
-
Activity¶
-
class
iatikit.data.activity.
Activity
(etree, dataset=None, schema=None)[source]¶ Class representing an IATI activity.
-
actual_end
¶ Return the actual end date for this activity, as a python
date
.
-
actual_start
¶ Return the actual start date for this activity, as a python
date
.
-
description
¶ Return a list of descriptions for this activity.
-
end
¶ Return the actual end date for this activity, if present. Otherwise, return the planned end.
-
humanitarian
¶ Return True if the humanitarian flag is set for this activity.
-
iati_identifier
¶ Return the iati-identifier for this activity, or
None
if it isn’t provided.
-
id
¶ Alias of
iati_identifier
.
-
location
¶ Return a list of locations for this activity.
-
planned_end
¶ Return the planned end date for this activity, as a python
date
.
-
planned_start
¶ Return the planned start date for this activity, as a python
date
.
-
sector
¶ Return a list of sectors for this activity.
-
start
¶ Return the actual start date for this activity, if present. Otherwise, return the planned start.
-
title
¶ Return a list of titles for this activity.
-
xml
¶ Return the raw XML of this activity, as a byte-string.
-
OrganisationSet¶
-
class
iatikit.data.organisation.
OrganisationSet
(datasets, **kwargs)[source]¶ Class representing a grouping of
Organisation
objects.Objects in this grouping can be filtered and iterated over. Queries are only constructed and run when needed, so they can be efficient.
-
all
()¶ Return a list of all items in this set.
-
count
()¶ The number of items in this set.
Equivalent to
len(self)
.
-
filter
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.Alias of
where(**kwargs)
.
-
find
(**kwargs)¶ Return the first matching item from the set, according to the filters provided in
kwargs
.If no matching item is found, an
IndexError
is raised.
-
first
()¶ Return the first item in this set.
Raises an
IndexError
if the set contains zero items.Equivalent to
self[0]
.
-
get
(item, default=None)¶ Return an item from the set, according to the primary key.
If no matching item is found,
default
is returned.
-
where
(**kwargs)¶ Return a new set, with the filters provided in
**kwargs
.
-
Organisation¶
-
class
iatikit.data.organisation.
Organisation
(etree, dataset=None, schema=None)[source]¶ Class representing an IATI organisation.
-
id
¶ Alias of
org_identifier
.
-
org_identifier
¶ Return the org-identifier for this organisation, or
None
if it isn’t provided.
-
xml
¶ Return the raw XML of this organisation, as a byte-string.
-