P2N dex

Generalities

dex.py is a script that allows to perform mutations on the local state of the application. It allows the user to be informed about the latest script execution and data modification. The state is saved in json format in a file named dex.json

Dex format

{
    "in_progress":[
    "jack"
    ],
    "done":[
    "lentille",
    "machinelearning"
    ],
    "requests":{
    "machinelearning":{
        "state":"SPLITER_RUN",
        "data":{
            "progress":{
                "p2n_gather_biblio":{
                "value":"100.00",
                "max_value":"100"
                },
                "p2n_family":{
                "value":"100.00",
                "max_value":"100"
                },
                "...":{}
            },
            "to_be_found":{
                "need_spliter":true,
                "amount":10000,
                "lstFicOk":[

                ]
            },
            "spliter_start_date":2021,
            "spliter_result":{
                "start":true,
                "requests":[
                {
                    "name":"RequestsAuto/machinelearning/202101Request.cql",
                    "date":"2021",
                    "find":513
                },
                {
                    "name":"RequestsAuto/machinelearning/202102Request.cql",
                    "date":"2021",
                    "find":506
                },
                "..."
                ],
                "cumulative":2675,
                "end":true
            },
            "process_list":{
                "start":true,
                "queue_list":[
                "202101Request.cql",
                "202102Request.cql",
                "..."
                ],
                "done_list":[
                "202101Request.cql",
                "202102Request.cql",
                "..."
                ],
                "end":true
            },
            "fusion_list":{
                "start":true,
                "queue_list":[
                "machinelearning_segments_202101",
                "machinelearning_segments_202102",
                "..."
                ],
                "done_list":[
                "machinelearning_segments_202101",
                "machinelearning_segments_202102",
                "..."
                ],
                "end":true
            }
        }
    },
    "lentille":{
        "state":"P2N_RUN",
        "data":{
            "progress":{
                "p2n_gather_biblio":{
                "value":"100.00",
                "max_value":"100"
                },
                "p2n_family":{
                "value":"85.71",
                "max_value":"100"
                },
                "...":{}
            }
        }
    }
    }
}

Methods

Patent2Net.app.dex.get_current_dex()[source]

Recover the current state of the application

Returns

a dictionary with all value of current dex

Return type

dict

State of a directory

Patent2Net.app.dex.set_in_progress(directory)[source]

Allows you to define a request as in progress

Parameters

directory (str) – The name of the directory of the request to set in progress

Patent2Net.app.dex.set_done(directory)[source]

Allows you to define a request as done

Parameters

directory (str) – The name of the directory of the request to set done

Patent2Net.app.dex.set_state(directory, state)[source]

Allows you to define the state of one request in progress

Parameters
  • directory (str) – The name of the directory of the request

  • state (str (P2N_RUN | SPLITER_RUN)) – The new state for this request

Patent2Net.app.dex.get_state(directory)[source]

Allows you to retrieve the current state of a directory

Parameters

directory (str) – The name of the directory of the request

Returns

the current state of a directory

Return type

str

Data linked to a directory

Patent2Net.app.dex.set_directory_request_data(directory, key, value)[source]

Allows to associate a value to a key on the data object of a request

Parameters
  • directory (str) – The name of the directory of the request to which the data will be associated

  • key (str) – The key to which the data will be associated

  • value (str) – The value returned if the data does not exist

Patent2Net.app.dex.get_directory_request_data(directory, key, default=None)[source]

Allows to get a value associated to a key on the data object of a query

Parameters
  • directory (str) – The name of the query directory to which the data is associated

  • key (str) – The key to which the data is associated

  • default (str (default is None)) – The data to be saved

Returns

the data

Return type

dict

Patent2Net.app.dex.get_directory_request_data_all(directory)[source]

Retrieves all data associated with a directory

Parameters

directory (str) – The name of the directory

Returns

the data

Return type

dict

Patent2Net.app.dex.delete_directory_request_data(directory, key)[source]

Delete the data

Parameters
  • directory (str) – The name of the directory

  • key (str) – The key of the data to be deleted