How to extract the project creation date and last activity on the project

SAURABH
SAURABH Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 30 Partner

Hi All,
Can anyone please suggest me action here on how can i get the project creation date and the last activity date of a project.
We have a dataiku instance and for that i need to extract the dates for project creation and project last activity

Answers

  • Yasmine_T
    Yasmine_T Registered Posts: 74 ✭✭✭✭

    Hi,

    I hope that you are doing well:)

    You could use the Python API, specifically: https://developer.dataiku.com/latest/api-reference/python/projects.html#dataikuapi.dss.project.DSSProject.get_timeline

    Which would return information regarding the project timeline ( info of interest would be createdOn: when the project was created and lastModifiedOn: when this modification took place)

    Let me know if you have any other questions or inquiries here.

    Best,

    Yasmine

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,586 Neuron

    Something like this will do:

    import datetime
    import dataiku
    import pandas as pd, numpy as np
    from dataiku import pandasutils as pdu

    client = dataiku.api_client()
    project_keys = client.list_project_keys()

    df_project_data = pd.DataFrame(columns=['project_key', 'project_name', 'project_status', 'project_tags', 'has_active_scenarios', 'project_owner', 'project_created_by', 'project_created_on', 'project_last_modified_on'])

    for project_key in project_keys:
    project = client.get_project(project_key)
    all_scenarios = project.list_scenarios()
    project_status = project.get_settings().get_raw().get('projectStatus')
    project_summary = project.get_summary()
    project_name = project_summary['name']
    project_owner = project_summary['ownerLogin']
    project_created_by = project_summary['creationTag']['lastModifiedBy']['login']
    project_created_on = datetime.datetime.utcfromtimestamp(int(project_summary['creationTag']['lastModifiedOn']) / 1000).strftime("%d-%b-%Y %H:%M:%S")
    project_last_modified_on = datetime.datetime.utcfromtimestamp(int(project_summary['versionTag']['lastModifiedOn']) / 1000).strftime("%d-%b-%Y %H:%M:%S")
    project_tags = list(project.get_tags()['tags'].keys())
    has_active_scenarios = ''
    for scenario in all_scenarios:
    scn_id = scenario['id']
    scn_settings = project.get_scenario(scenario.get('id')).get_settings()
    scn_settings_raw = scn_settings.get_raw()
    if scn_settings_raw['active'] == True:
    active_triggers = [x for x in scn_settings_raw.get('triggers') if x['active'] == True]
    if active_triggers:
    has_active_scenarios = 'Yes'
    break
    data_record = pd.DataFrame.from_dict({'project_key': [project_key], 'project_name': [project_name], 'project_status': [project_status], 'project_tags': [project_tags], 'has_active_scenarios': [has_active_scenarios],
    'project_owner': [project_owner], 'project_created_by': [project_created_by], 'project_created_on': [project_created_on], 'project_last_modified_on': [project_last_modified_on]})
    df_project_data = pd.concat([df_project_data, data_record], ignore_index=True)
Setup Info
    Tags
      Help me…