ConductScience Sequences
Contents

User guide · Programs and data

Connectors

Let your document system send an application's claims and sequence listing into a case.

A connector lets another system, such as your document system, send an application's claims and sequence listing into a case, so the case is ready when the searcher opens it. Each call sends one document set: a manifest, which says what the set is and which account owns the case, and the files it lists. The files go in through the same importers as on the page, so the case opens with its claims, the features the rules found and its listing.

Make a connector token

An admin of the server makes connector tokens. On the hosted service, write to support@conductscience.com for one.

  1. Choose API tokens from your account button. Below your own tokens, Connector tokens lists the server's.
  2. Name the token after the system that will use it, pick how long it lasts, and list the accounts it may make cases for, separated by commas or new lines. Each account must have signed in to this server once.
  3. Choose Make connector token and copy the token into a file the system can read, such as connector-token.txt. The page shows it only once.
  • The token can call only POST /api/connector/imports. It cannot search, open a case or make another token.
  • It makes cases only for the accounts you named, and only while you are an admin here. A case belongs to its owner, so you do not see it unless it is yours.
  • A server may have 20 live connector tokens, each for up to 50 accounts. The list shows when each was last used, and Revoke ends one.

The manifest

The manifest is a JSON object with these fields:

  • source: the sending system's name, up to 40 characters: letters, digits, spaces, dots, dashes and underscores.
  • sourceId: that system's own ID for the document set, such as a docket number, up to 100 characters. A set with the same source and sourceId always goes into the same case.
  • title: the case's name, up to 200 characters.
  • owner: the account that will own the case, as it signs in. The token must be allowed to name it.
  • applicationNumber and priorArtDate (YYYY-MM-DD), if you want to set them, with priorArtDateBasis: filing, priority or other, the default. Without them, a publication's XML gives the case its application number, and its filing date as the prior art date.
  • files: 1 to 5 files, each with its name (the file name alone, without a folder), its role and its sha256, the file's SHA-256 as 64 hexadecimal digits.
  • version: 1, if you give it.

Each file has one of three roles:

  • claims: a file of claims, as XML, a Word file (.docx) or text, up to 15 MiB.
  • listing: a WIPO ST.26 XML or ST.25 listing, plain or gzip, as Import on the Listings tab takes. A case has one listing.
  • publication-xml: one publication's full-text XML from the US patent office, an application or a grant, up to 15 MiB. Its claims become a set of claims in the case. When the manifest lists no listing and the XML holds one, that listing becomes the case's.

A complete manifest for a grant's XML and its listing:

{
  "version": 1,
  "source": "Docketing",
  "sourceId": "PAT-118",
  "title": "Insect neuropeptides, PAT-118",
  "owner": "ana@example.org",
  "files": [
    { "name": "PAT-118.xml", "role": "publication-xml", "sha256": "<SHA-256 of PAT-118.xml>" },
    { "name": "PAT-118-listing.xml", "role": "listing", "sha256": "<SHA-256 of PAT-118-listing.xml>" }
  ]
}

Work out each SHA-256 with sha256sum PAT-118.xml on Linux, shasum -a 256 PAT-118.xml on a Mac or Get-FileHash PAT-118.xml in PowerShell, which prints capitals: the manifest takes either.

Send a set

Send the manifest first, as the part named manifest, then each file as a part named file with its name from the manifest, all in one multipart/form-data request. With curl, from the folder that holds the files, and the token in SEQUENCES_CONNECTOR_TOKEN:

curl -H "Authorization: Bearer $SEQUENCES_CONNECTOR_TOKEN" \
  -F "manifest=<manifest.json;type=application/json" \
  -F "file=@PAT-118.xml" \
  -F "file=@PAT-118-listing.xml" \
  https://sequences.example.org/api/connector/imports

To try it, save connector-manifest.json as manifest.json in one folder with us12788009b2.xml and us12788009b2-listing.xml, and give the account the case is for as owner. The case it makes is an ordinary case, not a demo case, so only an admin can delete it.

The answer

The answer is 201 when the call made the case, and 200 when the set went into the case its source and sourceId made before:

{
  "case": {
    "id": "<case ID>",
    "title": "Insect neuropeptides, PAT-118",
    "owner": "ana@example.org",
    "made": true,
    "url": "https://sequences.example.org/?case=<case ID>"
  },
  "source": "Docketing",
  "sourceId": "PAT-118",
  "files": [
    { "name": "PAT-118.xml", "role": "publication-xml", "sha256": "<SHA-256 of PAT-118.xml>",
      "result": "imported", "claims": 9, "features": 3, "set": 1 },
    { "name": "PAT-118-listing.xml", "role": "listing", "sha256": "<SHA-256 of PAT-118-listing.xml>",
      "result": "imported", "sequences": 16, "listingId": "<listing ID>" }
  ]
}

Each file's result is one of:

  • imported: it went in. A file of claims gives its claims, the features the rules found and the set it became. A listing gives its sequences and listingId.
  • already: the case holds it from an earlier call. The same set sent again changes nothing, so a system can send a set again whenever it is unsure the first call arrived.
  • refused, with its reason: it did not go in. The other files did.

Each step in the case log names the token, such as "Docketing (connector)". The server's audit log records every call with its source, its ID and each file's SHA-256 and result.

What a refusal looks like

When the whole call is refused, nothing goes in, and the answer gives the reason as message:

403 Forbidden
{
  "message": "This connector token may not make cases for ben@example.org. An admin names the accounts it may make cases for when they make the token.",
  "source": "Docketing",
  "sourceId": "PAT-118"
}
  • 400: the manifest cannot be read, or a file is missing, not in the manifest or not the file its SHA-256 names. The message says what to change.
  • 401: the token is wrong, expired or revoked.
  • 403: the token may not name the owner, two accounts here use the owner's email address, or the admin who made it is no longer an admin.
  • 409: the case these documents went into before belongs to another account now.
  • 413: a file, or the whole request, is larger than the server takes.
  • 415: the request is not multipart/form-data.
  • 429: the search queue is full, so the listing cannot import now. Send the set again in a few minutes.

When one file is refused, the others go in, and its line gives the reason:

{
  "name": "PAT-118-listing-2.xml",
  "role": "listing",
  "sha256": "<SHA-256 of PAT-118-listing-2.xml>",
  "result": "refused",
  "reason": "The case has a listing already. Choose another in the case if this one should replace it."
}

When no file can go in, no case is made: the answer is 400, "No file could be imported, so no case was made.", with a line for each file. Fix what the message names and send the set again.

The folder program

Download sequences-connector.mjs, the reference program, and run it with Node.js 22 or later on a computer where your documents arrive and that can reach the server. It needs nothing else.

node sequences-connector.mjs watch --inbox /srv/sequences-inbox \
  --server https://sequences.example.org --token-file /etc/sequences/connector-token.txt
  • Each folder in the inbox is one set: its manifest.json and the files it lists. The program sends a set once every file it lists is there with its SHA-256, so a set still being copied in waits. A set that is still not whole after 10 minutes (--wait, in seconds) goes to failed/ unsent.
  • After the answer, the folder moves to done/ when every file went in or was in already, or to failed/ when the server refused the set or a file, with the answer beside the files as result.json. To send a failed set again, fix it and move it back into the inbox.
  • With no answer, or a 429 or 5xx answer, the set stays and goes again on the next round. A token the server no longer takes stops the program.
  • It reads the inbox every 30 seconds (--every), or once with --once. It never prints the token.

It prints a line for each set:

Sequences connector adapter 1.0.1: watching /srv/sequences-inbox, sending to https://sequences.example.org, every 30 seconds.
done PAT-118: 201, case <case ID> (new), 2 imported, 0 already in, 0 refused. Moved to /srv/sequences-inbox/done/PAT-118.

Guide version 1.91.0 · For Sequences 0.155.0