Package edu.wisc.game.rest

## Class MlcUploadService

- java.lang.Object
- - edu.wisc.game.rest.MlcUploadService

-     @Path("/MlcUploadService")
      public class MlcUploadService
      extends Object

  Uploading and processing results files by MLC participants. Discussed in email in June-July 2022. Extended in Jan 2023 to support compact format.

  This service includes calls for uploading data, and for various comparison pages.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MlcUploadService()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `compare​(String nickname, String rule)` | Prints the summary of a specified player's performance on a particular rule set, in comparison with other players.
    `String` | `compareRules​(String nickname, String rule)` | The REST call for comparing rule set with respect to an algo
    `static String` | `giveKey​(String nickname)` | Used by the MlcLoginServlet etc
    `String` | `summary​(String nickname, String rule)` | Prints the summary of a specified player's performance on a particular rule set
    `String` | `uploadFile​(String nickname, String key, org.glassfish.jersey.media.multipart.FormDataBodyPart parts)` | Allows an MLC participant to upload a file with the results of his ML algorithm's performance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MlcUploadService

          public MlcUploadService()

  - ### Method Detail

    - #### giveKey

          public static String giveKey​(String nickname)

      Used by the MlcLoginServlet etc

    - #### uploadFile

          @Path("/uploadFile")
          @POST
          @Consumes("multipart/form-data")
          @Produces("text/html")
          public String uploadFile​(String nickname,
                                   String key,
                                   org.glassfish.jersey.media.multipart.FormDataBodyPart parts)

      Allows an MLC participant to upload a file with the results of his ML algorithm's performance. For each section of the input file (a sequence of lines, each of which represents an episode), creates a single MlcEntry object containing the aggregate statistics for the runs represented by that section.

      Long format:

          nickname,rule_name,trial_id,board_id,number_of_pieces,number_of_moves,move_acc,if_clear
          RandomTest,alternateShape2Bucket_color2Bucket,0,0,9,29,0.3103448275862069,1
          RandomTest,alternateShape2Bucket_color2Bucket,0,1,9,20,0.45,1
          ...

      Compact format: see captive.html#results

          #.nickname,rule_name,trial_id
          #number_of_moves,number_of_errors,if_clear
          .RandomTest,alternateShape2Bucket_color2Bucket,0
          47,38,1
          36,27,1

    - #### summary

          @GET
          @Path("/summary")
          @Produces("text/html")
          public String summary​(@QueryParam("nickname")
                                String nickname,
                                @QueryParam("rule")
                                String rule)

      Prints the summary of a specified player's performance on a particular rule set

    - #### compare

          @GET
          @Path("/compare")
          @Produces("text/html")
          public String compare​(@QueryParam("nickname")
                                String nickname,
                                @QueryParam("rule")
                                String rule)

      Prints the summary of a specified player's performance on a particular rule set, in comparison with other players.
      Parameters:
        `nickname` - The nickname of the player being compared to others. It does not actually affect the content of the table (as it will show all players who have learned the rule set), but we will display the table row for this player in bold.

        Sample URL: `http://sapir.psych.wisc.edu:7150/w2020/game-data/MlcUploadService/compare?nickname=RandomTest&rule=position_A`

    - #### compareRules

          @GET
          @Path("/compareRules")
          @Produces("text/html")
          public String compareRules​(@QueryParam("nickname")
                                     String nickname,
                                     @QueryParam("rule")
                                     String rule)

      The REST call for comparing rule set with respect to an algo