Description
This feature aims at setting and tracking the achievements of the entities of AIESEC.
How it works
There will be plans for an entity to which the target is updated. The targets will be uploaded via an xlsx file which will contain the info of the programme and the targets for each programme and the various stages of applications. Only when the template is uploaded will the data be available in the analytics.
The achieved data is calculated on the first upload and then on every further update to an application. This is to ensure that the data is consistent and real-time.
The goal type - sign_ups will always return the total since its only based on home office.
Back-end
There are plans which has a start month and end month. Each entity has a deadline by which the entity has to upload a plan. The deadline will be set by the parent entity. The template will be processed and data will be entered into entity goals which will specify the type, programme and other details for that particular target.
Once the template is imported, the calculation for the targets created will be triggered. The achieved info of the goal will be updated. This calculation also happens for a particular goal when an application is updated.
The data can be fetched via analytics and it returns a list of entity goals. Filters are available for filtering necessary data. FE is expected to do the final calculation and consolidation.
Front-end
FE has access to multiple API's to facilitate this. The set deadline and file import mutation and entity plans and entity goal setting query for analytics will provide all the necessity needed by FE.
1. entityPlans - This query is used to fetch the plans for the entity. Upcoming is an optional parameter. If upcoming is false, it will show only the current plans. If upcoming is true, then the return data will only be the upcoming plans.
query {
entityPlans(office_id: 1585, upcoming: true) {
deadline
file_import {
url
filename
status
creator {
id
full_name
}
}
office {
id
}
plan {
id
start_month
end_month
mc_deadline
lc_deadline(office_id: 630)
}
}
}
2. planSetDeadline mutation - This mutation is used to set deadline to a plan. If an MC is setting the deadline, it'll be applicable for all the LCs under it. If AI set the deadline, that is the deadline for all MCs.
mutation {
planSetDeadline(office_id: 1585, plan_id: 1, deadline: "10-02-2020") {
id
start_month
end_month
name
mc_deadline
lc_deadline(office_id: 630)
}
}
3. fileImport mutation - This endpoint is used to upload all xlsx, csv type files and process the data. Its a general purpose endpoint and require FE to specify the type of file uploaded. For entity goals, FE should also pass in plan_id and office_id to meta in the input.
mutation{
fileImport(file_input: {import_type: "entity_goal",
meta: {plan_id: 1, office_id: 1585},
import_file: {
filename: "plan_template.xlsx",
content: "data:file/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBBQAA"
}
}
)
}
4. entity_goal_setting query - This is the query for analytics. Its not currently paginated and raw data is provided. Filters are available but consolidation of data is expected to happen at the FE.
query {
entityGoalSetting(office_id: 1585, programme_id: 1, exchange_type: incoming, opportunity_duration_type_id: 1, sub_product_group: information_technology_engineering, time_period: {from: "", to: ""}) {
office {
id
}
programme {
id
}
exchange_type
opportunity_duration_type {
id
duration_type
}
sub_product_group
goal_type
goal
achieved
}
}