onconova.terminology.services
artifacts_path
module-attribute
¶
FilterOperator
¶
CHILD_OF
class-attribute
instance-attribute
¶
DESCENDENT_LEAF
class-attribute
instance-attribute
¶
DESCENDENT_OF
class-attribute
instance-attribute
¶
EQUALS
class-attribute
instance-attribute
¶
EXISTS
class-attribute
instance-attribute
¶
GENERALIZES
class-attribute
instance-attribute
¶
IN
class-attribute
instance-attribute
¶
IS_A
class-attribute
instance-attribute
¶
IS_NOT_A
class-attribute
instance-attribute
¶
NOT_IN
class-attribute
instance-attribute
¶
REGEX
class-attribute
instance-attribute
¶
collect_codedconcept_terminology(CodedConceptModel, skip_existing=False, force_reset=False, prune_dangling=False, write_db=True)
¶
Collects and synchronizes a CodedConcept model with its associated FHIR ValueSet.
This function downloads and digests a FHIR ValueSet, and then processes its concepts according to the FHIR ValueSet composition rules. It then updates the associated CodedConcept model with the processed concepts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Type[CodedConcept]
|
The model class to synchronize. |
required |
|
bool
|
If True, skip synchronizing the model if it already contains entries. |
False
|
|
bool
|
If True, reset all model entries prior to synchronization. |
False
|
|
bool
|
If True, delete all dangling concepts in the model. |
False
|
|
bool
|
If False, skip writing into the database. |
True
|
Source code in onconova/terminology/services.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 |
|
download_canonical_url(canonical_url)
¶
Download the content from a canonical URL.
This function resolves the given canonical URL to an appropriate endpoint URL if it does not end with '.json', and then downloads the content from that endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The canonical URL from which to download content. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
dict
|
The downloaded content as a string. |
Source code in onconova/terminology/services.py
download_codesystem(canonical_url)
¶
Downloads and digests a code system from the given canonical URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The canonical URL of the code system to download. |
required |
Returns:
Name | Type | Description |
---|---|---|
CodeSystemMap |
CodeSystemMap
|
A mapping of codes to CodedConcept objects representing the concepts in the downloaded code system. |
Source code in onconova/terminology/services.py
download_valueset(canonical_url)
¶
Downloads a value set from a given canonical URL and expands it.
This function resolves the given canonical URL to an appropriate endpoint URL if it does not end with '.json', downloads the content from the endpoint, parses the content as a ValueSet resource, and expands it according to the rules defined in the ValueSet resource.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The canonical URL of the value set to download. |
required |
Returns:
Type | Description |
---|---|
List[CodedConcept]
|
List[CodedConcept]: A list of CodedConcept objects representing the concepts in the expanded value set. |
Source code in onconova/terminology/services.py
expand_valueset(valuesetdef)
¶
Expands a ValueSet definition to a list of CodedConcepts.
This function processes the given ValueSet definition and expands it to include all concepts defined by its expansion or composition rules.
Reference: [1] Value Set Expansion, HL7 FHIR R5 Documentation, https://hl7.org/fhir/valueset.html#expansion
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ValueSet
|
The ValueSet definition to expand. |
required |
Returns:
Type | Description |
---|---|
List[CodedConcept]
|
List[CodedConcept]: A list of expanded CodedConcept objects. |
Source code in onconova/terminology/services.py
follow_valueset_composition_rule(rule)
¶
Include one or more codes from a code system or other value set(s).
This function processes a ValueSetComposeInclude rule to determine which concepts to include based on specified systems, codes, and filters, as well as referenced value sets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
ValueSetComposeInclude
|
The composition rule defining the inclusion criteria. |
required |
Returns:
Type | Description |
---|---|
List[CodedConcept]
|
List[CodedConcept]: A list of CodedConcept objects that match the inclusion criteria. |
Source code in onconova/terminology/services.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
|