5555
5656
5757def _configure_llm_env () -> None :
58+ """Set default embedding model env vars for offline PCI mapping runs."""
5859 embed_model = os .environ .get ("CRE_EMBED_MODEL" )
5960 if not embed_model :
6061 vertex_embed = os .environ .get (
@@ -66,6 +67,7 @@ def _configure_llm_env() -> None:
6667
6768
6869def fetch_pci_rows (url : str = PCI_SHEET_CSV_URL ) -> List [Dict [str , str ]]:
70+ """Download PCI DSS spreadsheet rows that include a control id."""
6971 with urllib .request .urlopen (url , timeout = 120 ) as resp :
7072 raw = resp .read ().decode ("utf-8-sig" )
7173 reader = csv .DictReader (io .StringIO (raw ))
@@ -80,6 +82,7 @@ def resolve_with_method(
8082 cache ,
8183 control_embedding : List [float ],
8284) -> tuple [Optional [defs .CRE ], str , Optional [float ]]:
85+ """Resolve one PCI control embedding using the staged PCI DSS linker."""
8386 for threshold in PCI_DSS_CRE_SIMILARITY_THRESHOLDS :
8487 match = prompt .get_id_of_most_similar_cre_paginated (
8588 control_embedding , similarity_threshold = threshold
@@ -112,6 +115,7 @@ def compute_mappings(
112115 * ,
113116 limit : Optional [int ] = None ,
114117) -> List [Dict [str , Any ]]:
118+ """Embed PCI rows and resolve CRE links, returning per-control mapping records."""
115119 prompt = prompt_client .PromptHandler (cache )
116120 mappings : List [Dict [str , Any ]] = []
117121 total = len (rows ) if limit is None else min (limit , len (rows ))
@@ -155,6 +159,7 @@ def compute_mappings(
155159
156160
157161def main () -> int :
162+ """CLI entrypoint for computing PCI DSS to CRE mapping JSON."""
158163 parser = argparse .ArgumentParser (description = "Compute PCI DSS → CRE mappings" )
159164 parser .add_argument (
160165 "--cache-file" ,
0 commit comments