Skip to main content
POST
/
v2
/
context
Recall-first MKU retrieval over the knowledge graph (MKF v0.1.2)
curl --request POST \
  --url https://core.locusmedical.fr/v2/context \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "patient_ehr": {
    "sex": "F",
    "age": 34,
    "history": [
      "diabète type 2"
    ],
    "active_problems": [
      "grossesse 24 SA"
    ],
    "allergies": [
      "pénicilline"
    ],
    "current_treatments": [
      "warfarine"
    ]
  },
  "opts": {
    "include_unreviewed": false,
    "mode": "full",
    "concept_sim_topk": 50,
    "mku_sim_topk": 100,
    "fallback_chunk_topk": 50,
    "intersection_multihop_depth": 2,
    "judge_sufficiency_cutoff": 0.5,
    "judge_enabled": true,
    "agent_enabled": true,
    "w_cosine": 1,
    "w_overlap": 1,
    "w_intersection": 1
  }
}
'
{
  "query": "<string>",
  "mkus": [
    {
      "id": "<string>",
      "verbatim": "<string>",
      "criteria": "<string>",
      "directive": "<string>",
      "score": 123,
      "safety_critical": false,
      "review": false,
      "evidence_grade": "<string>",
      "strength": "<string>",
      "paths": [
        "<string>"
      ],
      "tags": [
        "<string>"
      ],
      "provenance": {
        "doc_id": "<string>",
        "doc_title": "<string>",
        "doc_url": "<string>",
        "reco_id": "<string>",
        "year": 123,
        "source_name": "<string>",
        "source_org": "<string>",
        "section_titles": [
          "<string>"
        ],
        "pages": [
          "<string>"
        ],
        "section_summaries": [
          "<string>"
        ],
        "doc_summary": "<string>",
        "degraded": false
      }
    }
  ],
  "trace": {
    "mode": "<string>",
    "include_unreviewed": true,
    "paths_activated": [
      "<string>"
    ],
    "judge_score": 123,
    "judge_sufficient": true,
    "judge_cutoff": 123,
    "counts": {},
    "config": {},
    "judge_rationale": "<string>",
    "judge_skipped": false,
    "query_concepts": [
      {
        "id": "<string>",
        "label": "<string>",
        "source": "<string>"
      }
    ],
    "patient_concepts": [
      {
        "id": "<string>",
        "label": "<string>",
        "source": "<string>"
      }
    ],
    "tags": [
      "<string>"
    ],
    "enrichment_degraded": false
  },
  "answer": "<string>",
  "safety_items": [
    "<string>"
  ],
  "conflicts": [
    {
      "description": "<string>",
      "patient_factor": "<string>",
      "mku_id": "<string>"
    }
  ],
  "cross_refs": [
    {
      "from_id": "<string>",
      "to_id": "<string>",
      "stance": "<string>"
    }
  ],
  "fallback": [
    {
      "chunk_id": "<string>",
      "text": "<string>",
      "score": 123,
      "doc_title": "<string>",
      "doc_url": "<string>",
      "source_name": "<string>",
      "section_summary": "<string>",
      "doc_summary": "<string>",
      "tag": "non_adjudiqué"
    }
  ],
  "tokens_in": 123,
  "tokens_out": 123
}

Authorizations

Authorization
string
header
required

Locus API key — paste the raw lsk_… value (no 'Bearer ' prefix).

Body

application/json
query
string
required

Free-text clinical question in French.

Minimum string length: 1
Example:

"Quelle antibiothérapie pour cette infection urinaire ?"

patient_ehr
PatientContext · object
required

Coarse patient EHR. Safety-signal facts (treatments, allergies, terrain) are mapped to concepts eagerly; used only in intersection with the query — never alone, except the safety sweep.

opts
ContextOpts · object

Response

Successful Response

query
string
required
mkus
MkuResult · object[]
required

Retained MKUs, ranked, with deterministic provenance.

trace
ContextTrace · object
required

Per-request eval data (logging is mandatory — spec §Logging).

answer
string | null

Agent adjudication (optional). Absent when the agent is disabled — the structured retrieval below is the primary payload.

safety_items
string[]

Ids of safety-relevant MKUs — addressed explicitly, never dropped.

conflicts
MkuConflict · object[]
cross_refs
CrossRef · object[]
fallback
FallbackChunk · object[]
tokens_in
integer | null
tokens_out
integer | null