<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Puneet Garg on Medium]]></title>
        <description><![CDATA[Stories by Puneet Garg on Medium]]></description>
        <link>https://medium.com/@puneet.garg0109?source=rss-e314a5c4ed47------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-m6IBNdwq0PgJslH</url>
            <title>Stories by Puneet Garg on Medium</title>
            <link>https://medium.com/@puneet.garg0109?source=rss-e314a5c4ed47------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:19:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@puneet.garg0109/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Global HR Policy Assistant with GraphRAG: A Beginner’s Guide]]></title>
            <link>https://medium.com/neo4j/building-a-global-hr-policy-assistant-with-graphrag-a-beginners-guide-e81ed8bc640d?source=rss-e314a5c4ed47------2</link>
            <guid isPermaLink="false">https://medium.com/p/e81ed8bc640d</guid>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[graphrag]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[human-capital-management]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Puneet Garg]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 23:21:54 GMT</pubDate>
            <atom:updated>2026-04-13T07:20:02.865Z</atom:updated>
            <content:encoded><![CDATA[<p>From Fragmented Policies to Connected Knowledge: The Classifier Node Pattern for Human Capital Management (HCM) Transformation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWh-AjETFXlX2CbU74321Q.png" /><figcaption>Human Capital Management (HCM) Transformation with GraphRAG</figcaption></figure><h3>Introduction</h3><p>Every large organization faces the same challenge: employees across different geographies need quick, accurate answers to policy questions. Whether it’s</p><ul><li>“Can I take paternity leave in India?”,</li><li>“What’s my health insurance coverage in the UK?”, or</li><li>“How do I claim medical expenses?”,</li></ul><p>HR teams spend countless hours answering repetitive questions.</p><p><strong>The problem?</strong> Policy documents are scattered, complex, and vary by country, band level, and benefit type. Traditional search falls short because it can’t understand the relationships between policies, eligibility criteria, and employee circumstances.</p><p><strong>The solution?</strong> GraphRAG (Graph Retrieval-Augmented Generation) — but here’s the catch: most teams get stuck building fragmented, disconnected knowledge graphs that don’t deliver value.</p><p><strong>The bigger picture?</strong> This isn’t just about answering policy questions. Global HR Policy automation is a foundational pillar of <strong>Human Capital Management (HCM) </strong>landscape, specifically in the Core HR and policy and entitlement layer where organizations define and operationalize rules around benefits, leave and compliance. By converting fragmented policy documents into structured, machine-interpretable knowledge, this capability establishes a foundation for higher-order HCM functions. Strategic talent management, workforce analytics, performance management and employee experience optimization all depend on consistent, explainable policy and eligibility logic. When employees can self-serve policy information, HR teams are freed to focus on strategic initiatives: talent development, succession planning, performance management, and organizational culture building.</p><p>This blog reveals a simple yet powerful technique that transforms how you build knowledge graphs: <strong>classifier nodes</strong> (also called metadata or taxonomy nodes). These structural elements like <em>BenefitType</em> and <em>BenefitCategory</em> are the secret to creating an interconnected graph early in your journey — without overthinking your schema.</p><p>This article is written to accompany the <a href="https://github.com/neo4j-field/genai-hcm">HCM Global HR Policies example project</a>. Many of the examples and processes detailed here are expanded upon and demonstrated in <a href="https://github.com/neo4j-field/genai-hcm">this Github project</a>.</p><h3>Before You Begin</h3><p>To follow along with the code examples and build your own Global HR Policy Assistant, you’ll need:</p><h3>Prerequisites:</h3><ol><li><strong>Access the GitHub repository — </strong><a href="https://github.com/neo4j-field/genai-hcm">https://github.com/neo4j-field/genai-hcm</a></li><li><strong>Neo4j Aura Free Account </strong>— Sign up at <a href="https://neo4j.com/cloud/aura-free">neo4j.com/cloud/aura-free</a></li><li><strong>Create a Database Instance</strong> — Set up a free AuraDB instance to populate your knowledge graph</li><li><strong>OpenAI API Key</strong> — Required for vector embedding and LLM-based entity extraction (get one at <a href="https://platform.openai.com/">platform.openai.com</a>)</li></ol><h3>What you’ll do:</h3><ul><li>Use the database instance to run the custom pipeline code</li><li>Populate your graph with sample HR policy documents</li><li>Deploy an Aura Agent on top of your knowledge graph</li></ul><p>💡 Tip: You can read through the concepts first, then come back to set up your environment when ready to code.</p><h3>The Common Knowledge Graph Pitfall</h3><p>When organizations first attempt to build knowledge graphs for HR policies, they often model the graph directly around extracted entities and documents, resulting in schemas that look like this:</p><pre>Employee → ELIGIBLE_FOR → Benefit<br>Benefit → DESCRIBED_IN → Document</pre><p><strong>What goes wrong:</strong></p><ul><li><strong>Fragmented islands</strong>: Each policy document becomes isolated</li><li><strong>Unclear modeling goal:</strong> The schema reflects “documents with extracted entities” rather than an organization domain model grounded in policy concepts</li><li><strong>Poor discoverability</strong>: Hard to explore what benefits exist</li></ul><p>The result? Teams spend weeks debating perfect schemas, then abandon the graph when it doesn’t deliver insights.</p><h3>The Classifier Node Solution</h3><p>Instead of just extracting benefits from documents, introduce <strong>classifier nodes</strong> that represent shared, controlled dimensions and organize your entities around them:</p><pre><br>// Without Classifier Nodes (Fragmented)<br>(MaternityLeave:Benefit {name: &quot;Maternity Leave&quot;})<br>(SickLeave:Benefit {name: &quot;Sick Leave&quot;})<br>(HealthInsurance:Benefit {name: &quot;Health Insurance&quot;})<br><br>// With Classifier Nodes (Connected)<br>(MaternityLeave:Benefit)-[:IS_OF_BENEFIT_TYPE]-&gt;(Leave:BenefitType)<br>(SickLeave:Benefit)-[:IS_OF_BENEFIT_TYPE]-&gt;(Leave:BenefitType)<br>(HealthInsurance:Benefit)-[:IS_OF_BENEFIT_TYPE]-&gt;(Insurance:BenefitType)<br>(MaternityLeave)-[:IS_OF_BENEFIT_CATEGORY]-&gt;(Statutory:BenefitCategory)<br>(SickLeave)-[:IS_OF_BENEFIT_CATEGORY]-&gt;(Statutory:BenefitCategory)<br>(HealthInsurance)-[:IS_OF_BENEFIT_CATEGORY]-&gt;(Company:BenefitCategory)c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fbtJTfxvvzOWTdfPC6UyyA.png" /><figcaption>From Fragmented Data to Connected Insights</figcaption></figure><p><strong>Why this works:</strong></p><ol><li><strong>Instant connectivity</strong>: All benefits of the same type are now connected</li><li><strong>Exploratory queries</strong>: Users can browse all LEAVE types or all STATUTORY benefits</li><li><strong>Stable schema</strong>: Adding new benefits doesn’t require schema changes</li><li><strong>Lightweight governance</strong>: Classifier nodes emerge from properties extracted during ingestion (e.g., type: “LEAVE” becomes `BenefitType` node), creating a manageable taxonomy that governs retrieval queries and can be refined over time without disrupting the underlying benefit data</li><li><strong>Multi-dimensional navigation</strong>: Query by type, category, country, or band level</li></ol><p>The beauty of the classifier node approach is that it gives you a production-ready graph right from the start — immediately queryable and valuable. But once you have this foundation, you can naturally extend it with richer domain entities as your needs grow.</p><h3>Real-World Example: Global HR Policy GraphRAG</h3><p>Let’s build a practical knowledge graph for HR policies across multiple countries (India, US, UK) covering leaves, compensation, and flexible working arrangements. Example policies data can be found <a href="https://github.com/neo4j-field/genai-hcm/tree/main/data">here</a>.</p><h3>Schema Design: The Classifier Node Approach</h3><p><strong>Core Entity Nodes:</strong></p><ul><li><strong>Benefit</strong>: Specific policy benefits</li><li><strong>Band</strong>: Organizational levels (Band 1–9)</li><li><strong>Country</strong>: Geographic locations</li><li><strong>PolicyDocument</strong>: Source documents</li></ul><p><strong>Classifier/Metadata Nodes:</strong></p><ul><li><strong>BenefitType</strong>: LEAVE, INSURANCE, RETIREMENT, ALLOWANCE, COMPLIANCE</li><li><strong>BenefitCategory</strong>: STATUTORY, COMPANY, SPECIAL, ENTITLEMENT</li></ul><p><strong>The Magic Pattern:</strong></p><pre>(Benefit)-[:IS_OF_BENEFIT_TYPE]-&gt;(BenefitType)<br>(Benefit)-[:IS_OF_BENEFIT_CATEGORY]-&gt;(BenefitCategory)<br>(Benefit)-[:APPLIES_TO_BAND]-&gt;(Band)<br>(PolicyDocument)-[:APPLIES_TO_COUNTRY]-&gt;(Country)</pre><p>Below highlights the graph schema model which has lexical and domain graph capture. All entities and relationships get extracted from chunks. Chunk contains text and embedding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7dZ7cIK1-2iGGLYPR7QsiA.png" /><figcaption>HR Policies Graph Model Schema</figcaption></figure><h3>From Quick Start to Production Quality: Why Custom Pipelines Matter</h3><p>The <strong>Neo4j GraphRAG Python package</strong> is designed to help you build knowledge graphs from unstructured data — transforming <a href="https://github.com/neo4j-field/genai-hcm/tree/main/data">PDFs</a>, documents, and text into structured, queryable graph databases. It provides <a href="https://github.com/neo4j-field/genai-hcm/blob/main/policies_simplekgpipeline.py">SimpleKGPipeline</a> as a convenient quick-start tool that’s perfect for prototyping and learning the basics. Checkout the complete pipeline code here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jWpk-SxHmqyVf4_KVuyuVg.png" /><figcaption>Snapshot of Example HR Policy PDF</figcaption></figure><pre>from neo4j_graphrag.experimental.pipeline.kg_builder import SimpleKGPipeline<br><br>kg_builder_pipeline = SimpleKGPipeline(<br>    llm=llm, # an LLMInterface for Entity and Relation extraction<br>    driver=neo4j_driver,  # a neo4j driver to write results to graph<br>    embedder=embedder,  # an Embedder for chunks<br>    from_pdf=True,   # set to False if parsing an already extracted text<br>    # schema={    # recommended, uncomment to use fixed schema<br>    #     &quot;node_types&quot;: NODE_TYPES,<br>    #     &quot;relationship_types&quot;: RELATIONSHIP_TYPES,<br>    #     &quot;patterns&quot;: PATTERNS,<br>    #     &quot;additional_node_types&quot;: False,<br>    # },<br>    perform_entity_resolution=True,  # enable entity resolution<br>)<br><br>await kg_builder_pipeline.run_async(file_path=&quot;india_leave_policy.pdf&quot;)</pre><p><strong>What you get:</strong> A working knowledge graph from your unstructured PDF in 10 lines of code — great for experimentation.</p><p><strong>However</strong>, to build <strong>production-quality knowledge graphs from </strong><a href="https://github.com/neo4j-field/genai-hcm/tree/main/data"><strong>unstructured data</strong></a>, you need to understand and control the nuances of the extraction pipeline. This is why we’ll walk through a <a href="https://github.com/neo4j-field/genai-hcm/blob/main/policies-custom-pipeline.py"><strong>custom pipeline implementation</strong></a><strong> (code link) </strong>that showcases:</p><ul><li><a href="https://github.com/neo4j-field/genai-hcm/tree/main/data"><strong>PDF</strong></a><strong> reader</strong></li><li><strong>Text chunking</strong></li><li><strong>Embed chunk</strong></li><li><strong>Two‑phase entity extraction for better accuracy</strong><br> • Document‑level extraction<br> • Chunk‑level extraction</li><li><strong>Merge</strong> two-phase entity extraction results</li><li><strong>Write</strong> lexical and domain graph</li><li><strong>Entity resolution</strong> to merge duplicates</li><li><strong>Index creation</strong> for vector and full-text search</li><li><strong>Post‑processing transformations to<br></strong> • Create classifier nodes<br> • Graph enhancement through relationship propagation</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yElYk0PbJNHPE2Qo6b3KA.png" /><figcaption>Custom Pipeline Phases</figcaption></figure><p>These production pipeline techniques reveal how to transform messy, unstructured policy documents into a clean, interconnected knowledge graph that powers real enterprise applications. Let’s dive into the challenges you’ll face and how to solve them.</p><h3>The Complete Custom Pipeline Architecture</h3><h4>Document to Knowledge Graph generation journey</h4><pre># ============================================================================<br># SCHEMA DEFINITIONS<br># ============================================================================<br><br><br># Document-Level Entity Schema<br># These entities are extracted only from the first chunk as they apply to the entire document<br>DOCUMENT_LEVEL_NODE_TYPES = [<br>    {<br>        &quot;label&quot;: &quot;Country&quot;,<br>        &quot;description&quot;: &quot;Represents a country where this policy document is applicable&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;country code i.e. US, IN, UK etc.&quot;},<br>            {&quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;country name i.e. United States, India, United Kingdom etc.&quot;}<br>        ]<br>    },<br>    {<br>        &quot;label&quot;: &quot;PolicyDocument&quot;,<br>        &quot;description&quot;: &quot;represents source policy document information at the entire document level,  applicable country and other information. this information comes from documet title, abstract, introduction section.&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Policy title in upper case and space seperated by -&quot;},<br>            {&quot;name&quot;: &quot;title&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Policy title&quot;},<br>            {&quot;name&quot;: &quot;category&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;document policy category representtion i.e. LEAVE, HOLIDAY, COMPENSATION etc.&quot;},<br>            {&quot;name&quot;: &quot;version&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;status&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Document status: draft, active, archived, superseded&quot;},<br>            {&quot;name&quot;: &quot;effectiveDate&quot;, &quot;type&quot;: &quot;DATE&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;expiryDate&quot;, &quot;type&quot;: &quot;DATE&quot;},<br>            {&quot;name&quot;: &quot;lastUpdated&quot;, &quot;type&quot;: &quot;DATE&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;countryId&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;regionId&quot;, &quot;type&quot;: &quot;STRING&quot;},<br>        ]<br>    }<br>]<br><br>DOCUMENT_LEVEL_RELATIONSHIP_TYPES = [<br>    {<br>        &quot;label&quot;: &quot;APPLIES_TO_COUNTRY&quot;,<br>        &quot;description&quot;: &quot;Policy document applies to a specific country&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;effective_date&quot;, &quot;type&quot;: &quot;DATE&quot;},<br>            {&quot;name&quot;: &quot;expiry_date&quot;, &quot;type&quot;: &quot;DATE&quot;},<br>            {&quot;name&quot;: &quot;since&quot;, &quot;type&quot;: &quot;DATE&quot;},<br>            {&quot;name&quot;: &quot;status&quot;, &quot;type&quot;: &quot;STRING&quot;}<br>        ]<br>    }<br>]<br><br>DOCUMENT_LEVEL_PATTERNS = [<br>    (&quot;PolicyDocument&quot;, &quot;APPLIES_TO_COUNTRY&quot;, &quot;Country&quot;)<br>]<br><br># Chunk-Level Entity Schema<br># These entities are extracted from all chunks as they contain detailed policy information<br>CHUNK_LEVEL_NODE_TYPES = [<br>    {<br>        &quot;label&quot;: &quot;Band&quot;,<br>        &quot;description&quot;: &quot;Organizational hierarchy level or grade defining employee classification. If mention of range Band 1 - 4, break it down to Band 1, Band 2, Band 3, Band 4 etc.&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;level&quot;, &quot;type&quot;: &quot;INTEGER&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True}<br>        ]<br>    },<br>    {<br>        &quot;label&quot;: &quot;Benefit&quot;,<br>        &quot;description&quot;: &quot;HR policy target benefit information.&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True},<br>            {&quot;name&quot;: &quot;type&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit type i.e. LEAVE, INSURANCE, RETIREMENT, ALLOWANCE, TERMINATION, ARRANGEMENT, COMPLIANCE etc.&quot;},<br>            {&quot;name&quot;: &quot;category&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit category i.e. STATUTORY, COMPANY, SPECIAL, ENTITLEMENT, RESTRICTION, PROCEDURE, HEALTH, etc.&quot;},<br>            {&quot;name&quot;: &quot;bandId&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;description&quot;: &quot;Band-specific benefit; null means applies to all bands&quot;},<br>        ]<br>    },<br>    {<br>        &quot;label&quot;: &quot;BenefitType&quot;,<br>        &quot;description&quot;: &quot;Benefit type i.e. LEAVE, INSURANCE, RETIREMENT, ALLOWANCE, TERMINATION, ARRANGEMENT, COMPLIANCE etc.&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit type upper case and space seperated by -&quot;},<br>            {&quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit type&quot;}<br>        ]<br>    },<br>    {<br>        &quot;label&quot;: &quot;BenefitCategory&quot;,<br>        &quot;description&quot;: &quot;Benefit category i.e. STATUTORY, COMPANY, SPECIAL, ENTITLEMENT, RESTRICTION, PROCEDURE, HEALTH, etc.&quot;,<br>        &quot;properties&quot;: [<br>            {&quot;name&quot;: &quot;id&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit category upper case and space seperated by -&quot;},<br>            {&quot;name&quot;: &quot;name&quot;, &quot;type&quot;: &quot;STRING&quot;, &quot;required&quot;: True, &quot;description&quot;: &quot;Benefit category&quot;}<br>        ]<br>    }<br>]<br><br>CHUNK_LEVEL_RELATIONSHIP_TYPES = [<br>    {<br>        &quot;label&quot;: &quot;APPLIES_TO_BAND&quot;,<br>        &quot;description&quot;: &quot;Benefit applies to a specific organizational band&quot;<br>    },<br>    {<br>        &quot;label&quot;: &quot;IS_OF_BENEFIT_TYPE&quot;,<br>        &quot;description&quot;: &quot;Benefit is classified under a specific benefit type&quot;<br>    },<br>    {<br>        &quot;label&quot;: &quot;IS_OF_BENEFIT_CATEGORY&quot;,<br>        &quot;description&quot;: &quot;Benefit is classified under a specific benefit category&quot;<br>    }<br>]<br><br>CHUNK_LEVEL_PATTERNS = [<br>    # Benefit Core Relationships<br>    (&quot;Benefit&quot;, &quot;APPLIES_TO_BAND&quot;, &quot;Band&quot;),<br>    (&quot;Benefit&quot;, &quot;IS_OF_BENEFIT_TYPE&quot;, &quot;BenefitType&quot;),<br>    (&quot;Benefit&quot;, &quot;IS_OF_BENEFIT_CATEGORY&quot;, &quot;BenefitCategory&quot;)<br>]<br></pre><pre>async def process_single_pdf(pdf_path: str, llm, neo4j_driver) -&gt; Neo4jGraph:<br>    &quot;&quot;&quot;Production-quality pipeline with custom extraction logic&quot;&quot;&quot;<br>    <br>    # Phase 1: Load document<br>    loader = PdfLoader()<br>    document = await loader.run(filepath=pdf_path)<br>    <br>    # Phase 2: chunk text<br>    splitter = FixedSizeSplitter()<br>    chunks = await splitter.run(text=document.text)<br>    <br>    # Phase 3: Generate embeddings<br>    embedder = OpenAIEmbeddings()<br>    text_chunk_embedder = TextChunkEmbedder(embedder)<br>    chunks = await text_chunk_embedder.run(text_chunks=chunks)<br>    <br>    # Phase 4: CHUNK-LEVEL extraction for Benefits<br>    extractor_chunk = LLMEntityRelationExtractor(<br>        llm=llm,<br>        create_lexical_graph=True,<br>    )<br>    <br>    chunk_graph = await extractor_chunk.run(chunks, schema={<br>        &quot;node_types&quot;: CHUNK_LEVEL_NODE_TYPES,<br>        &quot;relationship_types&quot;: CHUNK_LEVEL_RELATIONSHIP_TYPES,<br>        &quot;patterns&quot;: CHUNK_LEVEL_PATTERNS,<br>        &quot;additional_node_types&quot;: False,<br>    })<br>    <br>    # Phase 4: DOCUMENT-LEVEL extraction for policy applicable country<br>    first_chunk = TextChunks(chunks=[chunks.chunks[0]])<br>    <br>    extractor_document = LLMEntityRelationExtractor(<br>        llm=llm,<br>        create_lexical_graph=False,<br>    )<br>    <br>    document_graph = await extractor_document.run(first_chunk, schema={<br>        &quot;node_types&quot;: DOCUMENT_LEVEL_NODE_TYPES,<br>        &quot;relationship_types&quot;: DOCUMENT_LEVEL_RELATIONSHIP_TYPES,<br>        &quot;patterns&quot;: DOCUMENT_LEVEL_PATTERNS,<br>    })<br>    <br>    # Phase 5: Merge graphs with conflict resolution<br>    merged_graph = merge_graphs(chunk_graph, document_graph)<br>    <br>    # Phase 6: Write to Neo4j<br>    writer = Neo4jWriter(driver=neo4j_driver)<br>    await writer.run(graph=merged_graph)<br>    <br>    return merged_graph</pre><h4>Entity Resolution and Indexes</h4><p><strong>Entity Resolution</strong> merges duplicate entities that might have been extracted with slight variations:</p><pre># Phase 7: Merge entities with matching ID properties<br>resolver = SinglePropertyExactMatchResolver(<br>    driver,<br>    resolve_property=&quot;id&quot;,<br>)<br>resolution_stats = await resolver.run()</pre><p><strong>Create Indexes</strong> for efficient retrieval:</p><ul><li><strong>Fulltext</strong>: Fast keyword matching (“maternity leave India”)</li><li><strong>Vector</strong>: Semantic similarity (“pregnancy benefits” finds maternity leave content)</li></ul><pre># Phase 8: Indexes<br># Fulltext index for keyword search on chunk text<br>create_fulltext_index(<br>    driver, <br>    &quot;policy_text_chunk_fulltext_index&quot;, <br>    label=&quot;Chunk&quot;, <br>    node_properties=[&quot;text&quot;]<br>)<br><br># Vector index for semantic similarity search on embeddings<br>create_vector_index(<br>    driver,<br>    &quot;policy_text_chunk_vector_embedding_index&quot;,<br>    label=&quot;Chunk&quot;,<br>    embedding_property=&quot;embedding&quot;,<br>    dimensions=1536,<br>    similarity_fn=&quot;cosine&quot;,<br>)</pre><h4>Post-Processing</h4><p>Post-processing transforms the raw extracted graph into a production-ready structure by ensuring your graph is clean, connected, and query-ready for production deployment.</p><pre># Phase 9: Post processing graph cleanup and optimization<br><br>async def post_processing(neo4j_driver):<br>    &quot;&quot;&quot;Transform properties to classifier nodes and enhance connections&quot;&quot;&quot;<br>    <br>    # Create BenefitType nodes from properties<br>    await run_query(&quot;&quot;&quot;<br>        MATCH (b:Benefit)<br>        WHERE b.type IS NOT NULL <br>        MERGE (bt:BenefitType {id: toUpper(replace(b.type, &#39; &#39;, &#39;-&#39;))})<br>        ON CREATE SET bt.name = b.type<br>        MERGE (b)-[:IS_OF_BENEFIT_TYPE]-&gt;(bt)<br>    &quot;&quot;&quot;)<br>    <br>    # Create BenefitCategory nodes from properties<br>    await run_query(&quot;&quot;&quot;<br>        MATCH (b:Benefit)<br>        WHERE b.category IS NOT NULL<br>        MERGE (bc:BenefitCategory {id: toUpper(replace(b.category, &#39; &#39;, &#39;-&#39;))})<br>        ON CREATE SET bc.name = b.category<br>        MERGE (b)-[:IS_OF_BENEFIT_CATEGORY]-&gt;(bc)<br>    &quot;&quot;&quot;)<br>    <br>    # Remove redundant properties<br>    await run_query(&quot;&quot;&quot;<br>        MATCH (b:Benefit) <br>        WHERE b.type IS NOT NULL AND b.category IS NOT NULL<br>        REMOVE b.type, b.category<br>    &quot;&quot;&quot;)<br>    <br>    # Propagate Country to all chunks<br>    await run_query(&quot;&quot;&quot;<br>        MATCH (firstChunk:Chunk {index: 0})<br>        MATCH (firstChunk)-[:FROM_CHUNK]-(country:Country)<br>        MATCH (firstChunk)-[:FROM_DOCUMENT]-&gt;(:Document)&lt;-[:FROM_DOCUMENT]-(allChunks:Chunk)<br>        MERGE (allChunks)-[:APPLIES_TO_COUNTRY]-&gt;(country)<br>    &quot;&quot;&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TwJS_FlmJyZ5nRNRauNLvA.png" /><figcaption>Resulting Graph Schema</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwcnwiU1wy_y4Fw6d-2cRg.png" /><figcaption>Resulting Connected Graph of a Policy Doc (Yellow: Document, Pink: Chunk, Green: Benefit, Blue: Band, Red: BenefitCategory, Amber: BenefitType)</figcaption></figure><h3>Building an Agentic Bot to Explore Your Policy Knowledge Graph</h3><p>With your knowledge graph built, the next step is deploying an <strong>intelligent agent</strong> that employees can interact with naturally. We’ll use <strong>Neo4j Aura Agents</strong> to create a bot that autonomously explores the graph, combining <strong>vector similarity search</strong> for semantic understanding with <strong>graph traversal</strong> for precise filtering based on employee context (country, band level, benefit types).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6A5cxa0jCc5K_mbNqxUKLQ.png" /><figcaption>Agentic Bot to Explore Policy Knowledge Graph</figcaption></figure><h4>The Agent’s Exploration Strategy:</h4><ol><li><strong>Understand intent</strong> — Extract entities (country, band, benefit type)</li><li><strong>Vector search</strong> — Find semantically similar policy content</li><li><strong>Graph navigation</strong> — Traverse through classifier nodes (BenefitType, BenefitCategory)</li><li><strong>Filter by context</strong> — Apply APPLIES_TO_BAND, APPLIES_TO_COUNTRY relationships</li><li><strong>Synthesize answer</strong> — Combine graph structure with retrieved content</li></ol><h4>Agent Capabilities:</h4><ul><li>🎯 <strong>Semantic understanding</strong> via vector embeddings</li><li>🔍 <strong>Precise filtering</strong> via graph relationships</li><li>🧭 <strong>Intelligent navigation</strong> through classifier nodes</li><li>🔗 <strong>Multi-hop reasoning</strong> across benefit connections</li><li>💡 <strong>Contextual synthesis</strong> combining graph + LLM</li></ul><h3>Deploying Your Agentic Bot:</h3><h3>1. Configure Aura Agent using AI</h3><ul><li>Access Neo4j Aura Console</li><li>Navigate to Agents menu and click create with AI</li><li>Connect to your knowledge graph database</li><li>Set the prompt. For example:</li></ul><p><em>You have access to a global HR policies data set. you will help employees explore policy related queries.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*LGfdi07RPeHC6TnZCMkxfQ.png" /><figcaption>Create Aura Agent with AI</figcaption></figure><h3>2. Review and Save Your AI-Generated Aura Agent</h3><p><strong>What happens:</strong> Aura automatically generates an agent with tools based on your graph schema and indexes.</p><p><strong>Your action:</strong> Review the auto-generated configuration and customize as needed.</p><p><strong>💡 Pro tip:</strong> For faster setup and clearer results, simplify the AI-generated Agent description and prompt text if it’s too verbose. Use these concise versions:</p><p><strong>Description</strong>:</p><p>Answers questions about global HR policies, benefits, bands, and policy documents, leveraging both structured data and embedded text chunks.</p><p><strong>Prompt</strong>:</p><p>You are an assistant for global HR policies. Provide clear and informative answers based on the available HR policy data.</p><p><strong>Final step:</strong> Save your agent configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoqkAUYnv7PolYkR--Cm4g.png" /><figcaption>Aura Agent Review and Save</figcaption></figure><h3>Explore Employee Questions using Aura Agent</h3><h4>Example 1: Contextual Personal Query</h4><h4>Employee Question:</h4><p>“I am in India, I am band 4, my stomach is hurting — can I claim hospital bill and take some days rest?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1wMliBtkfTsNFQVC_y4izw.png" /><figcaption>Aura agent employee question example 1</figcaption></figure><h4>How the Agent Explores:</h4><p>The agent has access to these pre-configured tools and autonomously decides which to use:</p><h4>🛠️ Available Agent Tools:</h4><pre>✓ List Benefits for Band          (Cypher Template)<br>✓ List Policy Documents for Country (Cypher Template)<br>✓ List Benefits by Category        (Cypher Template)<br>✓ List Benefits by Type            (Cypher Template)<br>✓ Search Policy Chunks             (Similarity Search)<br>✓ Text2Cypher                      (Natural language to query)</pre><h4>🔧 Agent’s Tool Selection &amp; Execution:</h4><pre>Step 1: Search Policy Chunks (Similarity Search)<br>  Purpose: Find content about medical claims and sick leave<br>  Input: &quot;hospital bill claim sick leave Band 4 India&quot;<br>  Results: 8 relevant chunks about medical insurance and sick leave<br><br>Step 2: List Benefits by Type (Cypher Template)<br>  Purpose: Get structured data about LEAVE and INSURANCE benefits<br>  Filter: benefit_type IN [&#39;LEAVE&#39;, &#39;INSURANCE&#39;]<br>  Results: Sick Leave and Medical Insurance benefits<br><br>Step 3: List Benefits for Band (Cypher Template)<br>  Purpose: Verify Band 4 eligibility and get specific entitlements<br>  Filter: band_level = 4, country = &#39;IN&#39;<br>  Results: Band 4 specific coverage amounts and leave days<br><br>Step 4: Synthesize Answer<br>  Combines: Semantic search + Structured benefit data + Eligibility rules</pre><h4>Agent Response:</h4><p>“Yes! As a Band 4 employee in India, you have two relevant benefits:</p><p>💊 Sick Leave</p><ul><li>Entitlement: 15 days per calendar year</li><li>Certificate: Self-declaration for 2–3 days; medical certificate required for longer absences</li><li>Usage: Submit leave request through HR portal</li></ul><p>🏥 Medical Insurance</p><ul><li>Coverage: ₹10 lakhs for hospitalization</li><li>Network: 5,000+ cashless hospitals across India</li><li>Process: Pre-authorization required for planned hospitalization; emergency cases handled through TPA</li><li>Room: Private single room eligible at your band</li></ul><p><strong>Recommendation:</strong> Use sick leave for rest days and medical insurance for hospital bills. For stomach issues requiring hospitalization, contact TPA for cashless treatment authorization.”</p><h4>Example 2: Discovering All Benefits in a Category</h4><h4>Employee Question:</h4><p>“What are all types of leaves available for India with a brief summary?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*daqj9nDHRIFyT-jpBBF5sg.png" /><figcaption>Aura agent employee question example 2</figcaption></figure><h4>How the Agent Explores:</h4><h4>🔧 Agent’s Tool Selection &amp; Execution:</h4><pre>Step 1: List Policy Documents for Country (Cypher Template)<br>  Purpose: Identify India policy documents<br>  Filter: country = &#39;IN&#39;<br>  Results: 3 India policy documents (Leave, Compensation, Flexible Work)<br><br>Step 2: List Benefits by Type (Cypher Template)<br>  Purpose: Get ALL benefits classified as LEAVE type<br>  Filter: benefit_type = &#39;LEAVE&#39;, country = &#39;IN&#39;<br>  Results: 7 leave benefits discovered via BenefitType classifier<br><br>Step 3: Search Policy Chunks (Similarity Search)<br>  Purpose: Get detailed descriptions for each leave type<br>  Queries: Run semantic search for each discovered benefit<br>  Results: Top 2-3 descriptive chunks per leave type<br><br>Step 4: Organize Response<br>  Combines: Complete list from graph + Rich descriptions from search</pre><h4>Agent Response:</h4><p>“Here are all leave types available for India employees:</p><p>📅 Annual Leave (Earned Leave)</p><ul><li>Band 1–3: 20 days/year, max carryforward 30 days</li><li>Band 4–6: 24 days/year, increases to 26 after 5 years</li><li>Band 7–9: 28 days/year, unlimited carryforward</li></ul><p>🏃 Casual Leave</p><ul><li>Band 1–6: 12 days/year, cannot carry forward</li><li>Band 7–9: 15 days/year</li><li>Max 3 consecutive days without manager approval</li></ul><p>🤒 Sick Leave</p><ul><li>Band 1–3: 12 days, accumulate up to 36 days</li><li>Band 4–6: 15 days, accumulate up to 60 days</li><li>Band 7–9: Unlimited with medical certificate</li></ul><p>🤰 Maternity Leave</p><ul><li>26 weeks for first two children</li><li>100% salary with medical reimbursement</li></ul><p>👶 Paternity Leave</p><ul><li>10 working days within 6 months of birth</li></ul><p>😢 Bereavement Leave</p><ul><li>Immediate family: 5 days</li><li>Extended family: 3 days</li></ul><p>💍 Marriage Leave</p><ul><li>Own marriage: 5 consecutive days</li><li>Sibling’s marriage: 3 days</li></ul><p>Need details on any specific leave type?”</p><h3>The Path Forward: Building Your Complete HCM Knowledge Graph</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIEt79w5aDwAorbBmFBeew.png" /><figcaption>HCM Transformation Graphs</figcaption></figure><p>Most organizations contain seven key domains of business activity, which reflect how the organization operates and creates value. The workforce spans all seven domains as people and their relationships are the foundations of a successful organization.</p><p>Now that you have a foundational policy knowledge graph, here’s how to expand it into a comprehensive HCM system by connecting the core workforce knowledge graphs:</p><h4>The Seven Core HCM knowledge graphs</h4><p><strong>1. 👤 Employees</strong></p><ul><li>Skills &amp; competency mapping</li><li>Learning &amp; development paths</li><li>Career trajectory &amp; succession planning</li><li>Organizational intelligence &amp; team topologies</li><li>Retention risk modeling</li><li>Mentorship &amp; sponsorship networks</li></ul><p><strong>Use Cases:</strong> “Who has Python skills in my department?” | “Which employees are at high flight risk without a successor”</p><p><strong>2. 🔧 Process</strong> ✅ <strong>(This Blog — HR Policies Focus)</strong></p><ul><li>Operational surge planning</li><li>Compliance &amp; mandatory trainings adherence</li><li>Critical role dependency mapping</li></ul><p><strong>Use Cases:</strong> “What leave am I eligible for?” | “What’s the approval process for international transfer?”</p><p><strong>3. 📦 Suppliers</strong></p><ul><li>Vendor risk for critical workforce dependencies</li><li>Staffing agency &amp; contractor relationships</li><li>Managed workforce coordination</li></ul><p><strong>Use Cases:</strong> “Which contractors have React skills?” | “What’s our dependency on Vendor X?”</p><p><strong>4. 📊 Product</strong></p><ul><li>Workforce planning for product roadmaps</li><li>Technical debt &amp; expertise risk</li><li>Skill-to-product alignment</li></ul><p><strong>Use Cases:</strong> “Do we have enough AI engineers for the Q3 roadmap?” | “Which products have key person risks?”</p><p><strong>5. 💰 Transactions</strong></p><ul><li>Expense anomalies &amp; fraud</li><li>Approver fraud</li><li>Employee vendor collusion</li><li>Procurement &amp; workforce conflict of interest</li></ul><p><strong>Use Cases:</strong> “Flag unusual expense patterns” | “Identify potential conflicts of interest in vendor selection”</p><p><strong>6. 🏢 Customers</strong></p><ul><li>Customer relationship mapping</li><li>Service workforce alignment</li><li>Account knowledge risk / account manager churn impact</li><li>Field workforce deployment</li></ul><p><strong>Use Cases:</strong> “Which customers are at risk due to Account Manager Z leaving?” | “Which customers can introduce us to key decision makers at Prospect P?”</p><p><strong>7. 🔒 Network &amp; Security</strong></p><ul><li>Identity &amp; access governance</li><li>Insider threat detection</li><li>Role-to-access modeling</li><li>Privileged access &amp; sensitive role mapping</li><li>Shadow IT &amp; unsanctioned tool usage</li><li>Joiner-leaver-mover management</li></ul><p><strong>Use Cases:</strong> “Who has access to financial systems?” | “Identify shadow IT usage patterns”</p><p><strong>The Power of Connection:</strong> These 7 graphs become exponentially more valuable when linked — enabling cross-domain queries like “Show high-performing employees on critical products who are also key consultants at any of our most valuable customer accounts”</p><h3>Conclusion</h3><p>We’ve built a <strong>Global Policy Assistant</strong> — an agentic bot that transforms how employees interact with HR policies across geographies. By combining knowledge graph technology with AI agents, we’ve created a system that understands context, navigates complex policy structures, and delivers personalized answers 24/7.</p><p>Building this production-ready system didn’t require months of schema design or perfect planning. The secret was <strong>classifier nodes</strong> — a simple pattern that transformed our approach:</p><p>Instead of overthinking the perfect schema upfront, we:</p><ol><li><strong>Let the LLM extract</strong> benefits with simple properties (type: “LEAVE”, category: “STATUTORY”)</li><li><strong>Multi-Step Unstructured-to-Graph Custom Pipeline</strong></li><li><strong>Connected everything</strong> through relationships like IS_OF_BENEFIT_TYPE</li><li><strong>Got a queryable graph</strong> on Day 0 that could immediately answer employee questions, then evolve to Day 1 when you need richer domain entities.</li></ol><p>This Global Policy Assistant is just the beginning. You’ve built the foundational layer for <strong>HCM Transformation </strong>to extend by:</p><ul><li>Connecting employee data for personalized eligibility</li><li>Adding skills and performance for career guidance</li><li>Integrating compensation for total rewards analysis</li><li>Take workforce planning to the next level with predictive analytics</li></ul><h3>Resources</h3><p><strong>Code Repository:</strong> <a href="https://github.com/neo4j-field/genai-hcm">https://github.com/neo4j-field/genai-hcm</a></p><p><strong>Try It Yourself:</strong></p><ul><li>Neo4j GraphRAG Python Package: <a href="https://neo4j.com/docs/neo4j-graphrag-python/current/user_guide_kg_builder.html">https://neo4j.com/docs/neo4j-graphrag-python/current/user_guide_kg_builder.html</a></li><li>Neo4j AuraDB Free Tier: <a href="https://neo4j.com/cloud/aura-free/">https://neo4j.com/cloud/aura-free/</a></li><li>Neo4j Aura Agent: <a href="https://neo4j.com/developer/genai-ecosystem/aura-agent/">https://neo4j.com/developer/genai-ecosystem/aura-agent/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e81ed8bc640d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/building-a-global-hr-policy-assistant-with-graphrag-a-beginners-guide-e81ed8bc640d">Building a Global HR Policy Assistant with GraphRAG: A Beginner’s Guide</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>