openedx / openedx/openedx-core

Dynamic Content Brainstorming

Open
#344 5 comments 0 reactions 1 assignee View on GitHub

@kdmccormick is already working on this.

Since Aug 5, 2025.

Dominant language
Python
Stars
10
Forks
32
Avg merge
2d 17h
Merged PRs (30d)
12

Description

Strawman Model

Imagining we adopt https://cel.dev/ and trust a Python binding for it...

class Selector(Model):
    cel_query = TextField(...)
    @property
    def compiled_cel_query(self) -> CELQuery:
        return CELQuery.parse(self.cel_query)
class ContainerVersionSelector(Model):
    selector = FK(Selector)
    container_version = FK(ContainerVersion, related_name="cv_selectors")
def get_children(container_version) -> list[PubEntVersion]:
    children = container_version.entity_list.entities
    params = ... 
    for cv_selector in container_version.cv_selectors:
        children = cv_selector.selector.compiled_cel_query.evaluate(
            context=dict(children=children, params=params)
        )
    return children
class ItemBank(Selector):
    count = IntegerField(...)
    
    def __init__(self, count):
        super().__init__(count=count, cel_query=(
            "random_shuffle(params.seed, random_choice(params.seed, children, count))"
        )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.