Project Info
REDCap API methods for Project info
ProjectInfo (Base)
Responsible for all API methods under 'Projects' in the API Playground
Source code in redcap/methods/project_info.py
class ProjectInfo(Base):
"""Responsible for all API methods under 'Projects' in the API Playground"""
def export_project_info(
self,
format_type: Literal["json", "csv", "xml", "df"] = "json",
df_kwargs: Optional[Dict[str, Any]] = None,
):
"""
Export Project Information
Args:
format_type: Format of returned data
df_kwargs:
Passed to `pandas.read_csv` to control construction of
returned DataFrame. By default, nothing
Returns:
Union[str, List[Dict[str, Any]], pandas.DataFrame]: Project information
Examples:
>>> proj.export_project_info()
{'project_id': ...
...
'in_production': 0,
'project_language': 'English',
'purpose': 0,
'purpose_other': '',
...
'project_grant_number': '',
'project_pi_firstname': '',
'project_pi_lastname': '',
...
'bypass_branching_erase_field_prompt': 0}
"""
payload = self._initialize_payload(content="project", format_type=format_type)
return_type = self._lookup_return_type(format_type, request_type="export")
response = cast(Union[Json, str], self._call_api(payload, return_type))
return self._return_data(
response=response,
content="project",
format_type=format_type,
df_kwargs=df_kwargs,
)
def_field: str
inherited
property
readonly
The 'record_id' field equivalent for a project
field_names: List[str]
inherited
property
readonly
Project field names
!!! note These are survey field names, not export field names
forms: List[str]
inherited
property
readonly
Project form names
is_longitudinal: bool
inherited
property
readonly
Whether or not this project is longitudinal
metadata: Json
inherited
property
readonly
Project metadata in JSON format
token: str
inherited
property
readonly
API token to a project
url: str
inherited
property
readonly
API URL to a REDCap server
export_project_info(self, format_type='json', df_kwargs=None)
Export Project Information
Parameters:
Name | Type | Description | Default |
---|---|---|---|
format_type |
Literal['json', 'csv', 'xml', 'df'] |
Format of returned data |
'json' |
df_kwargs |
Optional[Dict[str, Any]] |
Passed to |
None |
Returns:
Type | Description |
---|---|
Union[str, List[Dict[str, Any]], pandas.DataFrame] |
Project information |
Examples:
>>> proj.export_project_info()
{'project_id': ...
...
'in_production': 0,
'project_language': 'English',
'purpose': 0,
'purpose_other': '',
...
'project_grant_number': '',
'project_pi_firstname': '',
'project_pi_lastname': '',
...
'bypass_branching_erase_field_prompt': 0}
Source code in redcap/methods/project_info.py
def export_project_info(
self,
format_type: Literal["json", "csv", "xml", "df"] = "json",
df_kwargs: Optional[Dict[str, Any]] = None,
):
"""
Export Project Information
Args:
format_type: Format of returned data
df_kwargs:
Passed to `pandas.read_csv` to control construction of
returned DataFrame. By default, nothing
Returns:
Union[str, List[Dict[str, Any]], pandas.DataFrame]: Project information
Examples:
>>> proj.export_project_info()
{'project_id': ...
...
'in_production': 0,
'project_language': 'English',
'purpose': 0,
'purpose_other': '',
...
'project_grant_number': '',
'project_pi_firstname': '',
'project_pi_lastname': '',
...
'bypass_branching_erase_field_prompt': 0}
"""
payload = self._initialize_payload(content="project", format_type=format_type)
return_type = self._lookup_return_type(format_type, request_type="export")
response = cast(Union[Json, str], self._call_api(payload, return_type))
return self._return_data(
response=response,
content="project",
format_type=format_type,
df_kwargs=df_kwargs,
)