Python scripts to publish and manage ERC publications on Confluence.
- Clone the repository or download as a .zip file
- Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate - Install dependencies:
pip install -r requirements.txt - Create a
.envfile in the root directory with your Confluence credentials (see.env.example)
A Python utility for automatically creating and organizing research publication pages in Confluence based on CSV data.
Code: https://github.com/touchdownllc/ercresources/blob/main/scripts/erc_publish_publications.py
This script reads research publication information from a CSV file and creates hierarchically organized pages in Confluence. It creates type-based parent pages (e.g., "Published Research") and publication detail pages under them.
- Python 3.6+
- Required Python packages (install via
pip):atlassian-python-apipandasrequestspython-dotenv
-
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile in the same directory as the script with the following variables:CONFLUENCE_URL=https://your-instance.atlassian.net CONFLUENCE_USERNAME=your_email@example.com CONFLUENCE_API_TOKEN=your_api_token CONFLUENCE_SPACE_KEY=SPACENAME CONFLUENCE_PARENT_PAGE_ID=123456789To create an API token:
- Go to Atlassian API tokens
- Click "Create API token"
- Give it a name and copy the token to your
.envfile
Your CSV file should contain the following columns:
Title(required): Publication titleAuthors(required): Publication authorsType(required): Publication type (e.g., "Research Publication")URL(optional): Link to the publicationSource URL(optional): Publishing source URLDate(optional): Publication dateAbstract(optional): Publication abstractKey Terms(optional): Related key termsTopic(optional): Research topicTHECB #(optional): THECB Project IDPublishing ERC(optional): Publishing ERC nameProject Abbreviated Name(optional): Short project nameResearch Area(optional): Research field or area
python erc_publish_publications.py --csv-file your_publications.csv
By default, the script looks for a file named erc_publications.csv if no file is specified.
python erc_publish_publications.py --delete
This requires typing "yes" to confirm deletion.
python erc_publish_publications.py --delete --dry-run
This shows what would be deleted without actually removing any pages.
- The script connects to Confluence using your API credentials
- It creates or updates parent pages for each unique publication type in your CSV
- For each publication in the CSV:
- Creates or updates a page with formatted details
- Organizes it under the appropriate type page
- Adds labels for filtering/categorization
- Invalid URLs are logged as warnings but pages are still created
- Check the logs for detailed error messages
- Ensure your Confluence API token has read/write permissions
- Verify the CSV format matches the expected column names
- If pages aren't appearing, check that the parent page ID is correct
A Python utility for automatically creating hyperlinks between data set pages and report pages in Confluence.
code: https://github.com/touchdownllc/ercresources/blob/main/scripts/erc_link_updater.py
This script searches for variable names in a source Confluence page (data set page) and links them to corresponding headings in a target Confluence page (report page). It's designed to work with TEA, THECB, and SBEC variable tables.
- Python 3.6+
- Required Python packages (install via
pip):atlassian-python-apibeautifulsoup4python-dotenv
-
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile in the same directory as the script with the following variables:CONFLUENCE_URL=https://your-instance.atlassian.net CONFLUENCE_USERNAME=your_email@example.com CONFLUENCE_API_TOKEN=your_api_token CONFLUENCE_SPACE=SPACENAMETo create an API token:
- Go to Atlassian API tokens
- Click "Create API token"
- Give it a name and copy the token to your
.envfile
python erc_link_updater.py --dataset-page-id DATASET_PAGE_ID --report-page-id REPORT_PAGE_ID --link-type LINK_TYPE
Where:
DATASET_PAGE_ID: The ID of the Confluence page containing the variables tableREPORT_PAGE_ID: The ID of the Confluence page containing headings to link to- 'LINK_TYPE' can be
thecb: Texas Higher Education Coordinating Board (default)sbec: State Board for Educator Certificationtea: Texas Education Agency
To remove all hyperlinks in the variables table and reset to plain text:
python erc_link_updater.py --dataset-page-id DATASET_PAGE_ID --report-page-id REPORT_PAGE_ID --reset
To find a Confluence page ID:
- Open the page in your browser
- Look at the URL, which will be in a format like:
https://your-instance.atlassian.net/wiki/spaces/SPACE/pages/123456789/Page+Title - The number (e.g.,
123456789) is the page ID
- The script connects to Confluence using your API credentials
- It locates the variables table in the source page
- For each variable name in the table, it searches for a matching heading in the target page
- When a match is found, it creates a hyperlink to that specific heading
- The script has built-in matching logic to handle different variable naming patterns
- If no table is found, the script will output "Table not found in source content"
- If variables aren't matching to headings, try adjusting the
score_thresholdparameter in thefind_heading_for_item_namefunction - Check Confluence permissions to ensure your API token has read/write access to the pages