celtic-project / LTI-PHP

PHP class library for building LTI integrations
GNU Lesser General Public License v3.0
48 stars 38 forks source link

How do I get student results from the third party after completing the course ? #33

Closed VkTestLab closed 2 years ago

VkTestLab commented 2 years ago

Hello

Hope you are doing well,

I have one question regarding LTI. I am using the 1.1 LTI version. How do I get student results from the third party after completing the course? so can you suggest to me how to handle the result response from the tool consumer? if possible please send me a sample code

Thank you in advance

Thanks.

spvickers commented 2 years ago

Not sure if I have understood your question fully, my apologies if I have not. But it sounds like you are asking about how an LTI Platform can retrieve the student results from an LTI Tool. There is no service defined in LTI to allow this to happen; at present all LTI services are defined to operate in the opposite direction - for example, the Result service which allows an LTI Tool to obtain the results for a line item in an LTI Platform (see https://github.com/celtic-project/LTI-PHP/wiki/Line-Item-service for documentation on how to use this service in this library). HTH.

adydev15 commented 2 years ago

Hi @spvickers

I have same issue and stuck with that.

We are consumer and we are connected via LTI for another LMS where they allow our user to do courses.

I am also finding possibility that how the result of the user can be fetched /read as we need to store that in our system and i guess that is the same concern of @VkTestLab correct ! ?

Is there any sample code how we can fetch/read result from provider ? can you please guide on this ?

Thanks n Regards

spvickers commented 2 years ago

As I tried to explain in my previous message, the IMS LTI specifications do not currently define any services to be provided by an LTI Tool. The only services are ones which an LTI Consumer provides for LTI Tools to call. If, as an LTI Platform, you want to get grades from an LTI Tool then you will need to investigate other solutions which the tool supports (e,g. their API) or ask the tool to use the existing LTI Outcomes services to send the grades to the LTI Consumer (assuming your LTI Consumer supports them).

adydev15 commented 2 years ago

Hi @spvickers

For more clarity we are consumer , we are connected to another LMS where we are doing their courses .

May be i have swapped the naming or not i dont know but as per the document of IMS we are consumer and they are provider in primary way we are platform and they're tool right .

As per your explanation i need to ask them if they're supporting the Outcomes services ..? correct ? If yes then we can do some stuff to read/fetch it.If yes do you have any reference code for the same just to get some insights because we tried to get use doOutcome function but we are getting some error but it may be the case that Tool doesnt support Outcome services ..

spvickers commented 2 years ago

Note that an LTI Platform is the name now used by IMS for what was called an LTI Tool Consumer. An LTI Tool is the name which has replaced an LTI Tool Provider. The only LTI services are called by a tool to a platform.

VkTestLab commented 2 years ago

Hello @spvickers

Now I am following the below document outcome service for reading the student result from the Tool provider.

image

Below is the my sample code :

    $user_id = 25;

    $consumer = new LTI_Tool_Consumer("Consumer Key","");
    $resource_link = new LTI_Resource_Link($consumer,'25-120988f929-274613'); // RESOURCE_LINK_ID
    $user = new LTI_User($resource_link, $user_id);
    //$userResult = new LTI_User_Result($resource_link, $user_id);

    //$userResult->ltiResultSourcedId = "25-82098-21uhd";
    //$userResult->resourceLinkId = "25-120988f929-274613";

    $outcome = new LTI_Outcome();

    if ($resource_link->doOutcomesService(LTI_Resource_Link::EXT_READ, $outcome, $user)) {
      $score = $outcome->getValue();

       echo "<pre>";
       print_r($score);
       exit;
    }

In ResourceLink.php

image

I have issue in doOutcomesService function I got null value in sourceResourceLink so can you please guide me how to resolve this or anything is wrong ?

Thanks.

spvickers commented 2 years ago

The Outcomes service allows a tool provider to send/receive grades to/from a tool consumer's gradebook; not vice versa. LTI does not define any services which allow tool consumers to make requests of a tool provider.

VkTestLab commented 2 years ago

Hello @spvickers

First of all, Thank you for the quick reply

I hope you are doing well

I am creating a tool consumer platform where our students can do courses in one of the tool provider ( they are providing different courses) To access the tool provider courses we are using LTI version 1.1. Now after completing the course and test by our students, then the tool provider can generate student results In terms of 0 and 1 so I need to fetch that result from the Tool provider and save this result in our system for future use. so how a tool consumer can access his grade book from the tool provider?

Can you please clear the below question doubt?

  1. Is there any Lti service for reading the student result from the tool provider? If yes, please mention the service or send me a reference URL?
  2. If there is no Lti service for reading the student result from the tool provider then how we can get student results from the tool provider side?

Thanks

spvickers commented 2 years ago

In answer to your questions:

  1. No, there is not. LTI does not currently provide any services of any type for platforms (tool consumers) to access data held by a tool (tool provider).
  2. Two suggestions: (a) have the tool use the LTI Basic Outcomes service to send the grades to your platform; (b) use the API provided by the tool (if any).
VkTestLab commented 2 years ago

Hello @spvickers

Ok thank you for your valuable suggestions

Using option 2. (a) I am getting the student result from the tool provider side right ?? can you send me some example code or documentation where I can get an idea of implementation.

spvickers commented 2 years ago

Yes, the tool provider will send the grade to the endpoint you provide for them to use.

For more details on the Basic Outcomes service, I would suggest you look at the IMS specification (https://www.imsglobal.org/spec/lti-bo/v1p1) or the ceLTIc Project's best practices guide (http://celtic.lti.tools/wiki/LTI/Best_Practice).

VkTestLab commented 2 years ago

Hello @spvickers

For reading the student grades from tool provider I am using LTI Basic Outcomes service :

Below is my request parameters to Lunch data : image

I pass two additional parameters for result in request parameters like

  1. lis_outcome_service_url
  2. lis_result_sourcedid

Now my question is how i get result from that url can you send me sample code ?

Thanks

spvickers commented 2 years ago

This library does not contain any code for a tool consumer receiving outcomes requests from a tool provider. Such code would be very tool consumer specific as it would be concerned with storing/retreiving values from its gradebok. However, if you want to see some sample code, I would suggest you look at one of the open source platforms such as Moodle, Sakai or Canvas.

VkTestLab commented 2 years ago

Hello @spvickers

I take the reference from the below repository for reading the student result from the tool provider.

https://github.com/celtic-project/LTI-PHP/wiki/Outcomes-service

image

can I use the above repo code for fetching the student grades from the third party ???

Thanks

spvickers commented 2 years ago

As I have said before, the library does NOT contain any code for handling outcomes as a platform (tool consumer). It just supports the use of the Basic Outcomes service as a tool (tool provider). As I understand, it is the former which you are looking for, and such code is very platform-specific and it depends upon their gradebook implementation.

VkTestLab commented 2 years ago

Hello @spvickers

I am very stuck on this issue can you please clear the below doubt?

I am using the outcome service for getting the result from the tool provider.

Am I need to third-party URL for fetching/reading the result when I used the outcome service? or any other way to read/fetch the result?

Thanks

spvickers commented 2 years ago

LTI does not provide any services which allow a tool consumer to request data from a tool provider. You will need to check with the tool provider as to what APIs/web services it offers to permit this. LTI only defines services which allow tool providers to access data in a tool consumer.

VkTestLab commented 2 years ago

Hello @spvickers

I hope you are doing well.

As per conversion with third party ( Tool provider ), they are sending result in below URL when i lunch data from tool consumer.

lis_outcome_service_url = https://example.com/lti_demo/outcome-response

But I did not get any result from this URL. so how can i check if tool provider is sent or not result to tool consumer.

I try below ways. I write logs in this URL but there are no any logs write in log file is there any way to handle response or check post data from sending by third party ?

Thanks.

spvickers commented 2 years ago

If that is the correct endpoint for the outcomes service in your platform, then I recommend that you check your web server's log files for connections received. Also make sure that the endpoint is visible to your tool provider.

VkTestLab commented 2 years ago

Hello @spvickers

Thank you so much for your help and support . finally I got result from the tool provider and my issue is resolved. once again thank you.

Now I have to handle error when any errors are generated from the server side so can you suggest me how to handle error if any error generated by tool provider ? so i can display proper message instead or server error message .

Now i am passing below additional parameters with Lunch Request.

launch_presentation_return_url = https://example.com/lti_demo/handle-error-response

But I did not get any response in above url when any errors are generated by tool provider.

Thanks.

spvickers commented 2 years ago

If a service request made by a tool provider fails then I would expect the tool provider to handle how this is reported. There is little a tool consumer can do since it may not have a live interaction with the user at that time (service requests are made directly between servers and not through the user's browser). All I can suggest is that you hold a log of the errors and allow a user with an appropriate role to access this log when they connect to your service.

spvickers commented 2 years ago

Note also that the launch_presentation_return_url is only used when a tool provider wishes to return the user to the tool consumer; i.e. redirect their browser page back to where the user came from. Service requests may take place whilst a user is interacting with the tool provider, but could be made at any time - the presence of the user in their system is not a requirement once the tool provider has all the data they need to make the request.