USPTO / PatentPublicData

Utility tools to help download and parse patent data made available to the public
Other
182 stars 80 forks source link

Patent Redbook XML Format : "agent" field is empty in the output json #61

Open aosingh opened 6 years ago

aosingh commented 6 years ago

Agent names are absent in the final output json.

TEST DATA

AS-IS

"agent":[]

SHOULD BE

 "agent":[
        {
            "name":{
                "type":"person",
                "raw":"Burns, Mark J.",
                "prefix":"",
                "firstName":"Mark J.",
                "middleName":"",
                "lastName":"Burns",
                "suffix":"",
                "abbreviated":"Burns, M.",
                "synonyms":[
                ]
            },
            "address":{
                "street":"",
                "city":"",
                "state":"",
                "zipCode":"",
                "country":"UNKNOWN",
                "email":"",
                "fax":"",
                "phone":""
            }
        }
    ],

CAUSE/Solutions

  1. Incorrect Xpath : The Xpath expression to grab the agent names returns nothing. The Xpath expression can be found here. The following 2 expression works and returns the result.

    private static final String FRAGMENT_PATH = "//us-parties/agents/agent|//agents/agent";

    or

    private static final String FRAGMENT_PATH = "//us-parties/agents/agent|//parties/agents/agent";
  1. The if condition here This condition checks whether the agent name is null. If it is then, agent is not added to the final result. Below is an example when the if condition will fail.
    <agents>
    <agent sequence="01" rep-type="attorney">
    <addressbook>
    <orgname>Summa, Allan &#x26; Addition, P.A.</orgname>
    <address>
    <country>unknown</country>
    </address>
    </addressbook>
    </agent>
    </agents>

    Here, we only have the orgname tag. The agent name is absent. We can atleast add the orgname in the output json.

Thanks.