Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting differences in ontology files (attempt 2) #9856

Merged
merged 119 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
d163267
Documenting differences in ontology files (attempt 2)
hrshdhgd Jun 20, 2023
b2677eb
switched inputs to owl file and make db files out of them
hrshdhgd Jun 20, 2023
88107e9
reports
hrshdhgd Jun 21, 2023
b86edd0
Added another line for MD
hrshdhgd Jun 29, 2023
3e2c292
added output format
hrshdhgd Feb 23, 2024
5f048e0
diff markdown
hrshdhgd Feb 23, 2024
bb7ba4c
New diff-md format and gh workflow to comment.
hrshdhgd Mar 3, 2024
b4f88ac
install oaklib
hrshdhgd Mar 3, 2024
eb80cae
set-output will be deprecated.
hrshdhgd Mar 3, 2024
82861fd
remove condition to check presence of file. It should be
hrshdhgd Mar 3, 2024
b83c280
added src/ontology/
hrshdhgd Mar 3, 2024
821610e
version 7 update
hrshdhgd Mar 3, 2024
0c820d6
version updates and debug code
hrshdhgd Mar 3, 2024
3711e88
test
hrshdhgd Mar 3, 2024
7aef8a9
minor edit
hrshdhgd Mar 3, 2024
8ede68b
addnl condition required
hrshdhgd Mar 3, 2024
4c86a99
if condition is wrong place
hrshdhgd Mar 3, 2024
c77ed56
converting file conteents to string
hrshdhgd Mar 3, 2024
7ed7cd0
add another debug line and new diff comitted
hrshdhgd Mar 3, 2024
a57e0d8
another debug line
hrshdhgd Mar 3, 2024
e753b06
minor edit
hrshdhgd Mar 3, 2024
aba9540
removed commented line
hrshdhgd Mar 3, 2024
05ff37d
new strategy to copy file contents
hrshdhgd Mar 3, 2024
46a72c4
test yaml read
hrshdhgd Mar 3, 2024
18e2098
test yaml read
hrshdhgd Mar 3, 2024
74d39bd
swiych out yaml with md but a different way of reading
hrshdhgd Mar 3, 2024
5d1cb84
optimized workflow
hrshdhgd Mar 3, 2024
aa9dea3
Added debug statements
hrshdhgd Mar 3, 2024
53ea0f0
new run
hrshdhgd Mar 3, 2024
bfe8471
testing: not running make diff-md to see if file contents read in tha…
hrshdhgd Mar 3, 2024
11d9128
rolled back
hrshdhgd Mar 3, 2024
dc02b66
formatting change
hrshdhgd Mar 4, 2024
00c4b12
full run
hrshdhgd Mar 4, 2024
fcc3d9f
corrected filename
hrshdhgd Mar 4, 2024
8d60850
updated workflow for truncation
hrshdhgd Mar 4, 2024
31bbc73
remove printing content
hrshdhgd Mar 4, 2024
7cbd93f
test truncation
hrshdhgd Mar 4, 2024
2883a54
edit truncate message
hrshdhgd Mar 4, 2024
3bc99dd
edit truncate message
hrshdhgd Mar 5, 2024
d53a1b1
remove ... at the beginning
hrshdhgd Mar 5, 2024
f0ebb0d
install latest oaklib and add link to diff if truncated
hrshdhgd Mar 18, 2024
bbb4cca
updated workflow to link file in comment
hrshdhgd Mar 18, 2024
15c9035
new make recipes
hrshdhgd Mar 18, 2024
ef44b2a
link corrected for diff file
hrshdhgd Mar 18, 2024
eb06c12
new run and add commit changes to PR file
hrshdhgd Mar 18, 2024
361ebd5
switched user from bot to PR actor
hrshdhgd Mar 18, 2024
7d3421b
secure way pof making an edit to the diff file
hrshdhgd Mar 18, 2024
ecba7f5
followed instructions from github to make commit
hrshdhgd Mar 18, 2024
ea9737e
trying something different
hrshdhgd Mar 18, 2024
41bfb07
remove -set-upstream flag
hrshdhgd Mar 18, 2024
a7cd9ad
just git push
hrshdhgd Mar 18, 2024
e81c515
added HEAD:
hrshdhgd Mar 19, 2024
cd5d4ee
pull before push
hrshdhgd Mar 19, 2024
cda208b
HEAD: not needed
hrshdhgd Mar 19, 2024
471aef0
some more changes to experiment with
hrshdhgd Mar 19, 2024
f8d124c
added head again
hrshdhgd Mar 19, 2024
d48ec7d
Add --force
hrshdhgd Mar 19, 2024
62b4962
remove force add checkout
hrshdhgd Mar 19, 2024
2574ff9
not base_ref head_ref
hrshdhgd Mar 19, 2024
683e8a1
split out workflow
hrshdhgd Mar 19, 2024
58ea65d
add --global flag
hrshdhgd Mar 19, 2024
519f5c5
add safe dir
hrshdhgd Mar 19, 2024
e1dbc88
rearranged steps
hrshdhgd Mar 19, 2024
aae4c16
Update difference_main-branch_base.md
github-actions[bot] Mar 19, 2024
2b340e8
use var
hrshdhgd Mar 19, 2024
d5e2643
Merge branch 'issue-9579-2' of https://github.com/obophenotype/human-…
hrshdhgd Mar 19, 2024
7a520a8
undo step shuffle and newer output
hrshdhgd Mar 19, 2024
0d9fccf
Update difference_main-branch_base.md
github-actions[bot] Mar 19, 2024
cdcf12c
expt comment checking out again
hrshdhgd Mar 19, 2024
8bb3cf5
Merge branch 'issue-9579-2' of https://github.com/obophenotype/human-…
hrshdhgd Mar 19, 2024
55d810b
shuffle steps
hrshdhgd Mar 19, 2024
098f1de
edits to path
hrshdhgd Mar 20, 2024
0bb2faa
corrected path
hrshdhgd Mar 20, 2024
ebc0357
I don't think I need to git fetch
hrshdhgd Mar 20, 2024
cadd9a6
cleanup
hrshdhgd Mar 20, 2024
5c4f4c1
comment commiting file
hrshdhgd Mar 20, 2024
448b5d5
comment all git commands
hrshdhgd Mar 20, 2024
c3ea1fa
copy-pasted jinja and edited as per Nico
hrshdhgd Mar 21, 2024
9e46788
renamed files
hrshdhgd Mar 21, 2024
b4e1605
make obo file without going through makefile since master doesn't hav…
hrshdhgd Mar 21, 2024
f466c61
edit_file needed
hrshdhgd Mar 21, 2024
8667131
edit-file needed
hrshdhgd Mar 25, 2024
ad59e4c
edit-file needed
hrshdhgd Mar 25, 2024
3139d04
add src/ontology/
hrshdhgd Mar 25, 2024
ff32c6d
remove src/ontology/tmp
hrshdhgd Mar 25, 2024
f2f6b65
path changes
hrshdhgd Mar 25, 2024
c01e87a
list dir
hrshdhgd Mar 25, 2024
3220ad1
move diff and run it via the makefile
hrshdhgd Mar 25, 2024
82fbffd
path correction
hrshdhgd Mar 25, 2024
dc71de9
testing paths
hrshdhgd Mar 25, 2024
9117a63
testing paths
hrshdhgd Mar 25, 2024
d73c14e
rename filename
hrshdhgd Mar 25, 2024
df754bc
testing paths
hrshdhgd Mar 25, 2024
f8f8be5
testing paths
hrshdhgd Mar 25, 2024
477ed51
testing paths
hrshdhgd Mar 25, 2024
e56f02f
testing paths
hrshdhgd Mar 25, 2024
afaaf18
commented an extra line
hrshdhgd Mar 25, 2024
ee470ac
no need for extra comment
hrshdhgd Mar 25, 2024
397b09f
Comment posting using old workflow
hrshdhgd Mar 25, 2024
a640a81
clean up
hrshdhgd Mar 26, 2024
76cf926
renamed file
hrshdhgd Mar 26, 2024
22e2883
renamed file
hrshdhgd Mar 26, 2024
099b3da
renamed file
hrshdhgd Mar 26, 2024
06149aa
renamed file
hrshdhgd Mar 26, 2024
939b7db
Added PHONYs
hrshdhgd Mar 26, 2024
7cc5fdd
changes based on Nico's comments
hrshdhgd Mar 26, 2024
847ad5b
typo
hrshdhgd Mar 26, 2024
1b13719
delete main branch diff markdown
hrshdhgd Mar 28, 2024
a0b3a6f
delete main branch diff markdown
hrshdhgd Mar 28, 2024
c0c4f11
deleted make goals as per Nico
hrshdhgd Mar 28, 2024
55e5e16
Merge branch 'master' into issue-9579-2
matentzn Mar 28, 2024
6feb833
Remove redundant files
matentzn Mar 28, 2024
6f89a12
Update hp.Makefile
matentzn Mar 28, 2024
0bdd8b2
Update ontology_diff.yml
matentzn Mar 28, 2024
2276255
Update ontology_diff.yml
matentzn Mar 28, 2024
45e78c8
Update hp-edit.owl
matentzn Mar 28, 2024
2088ab2
test latest oaklib version
hrshdhgd Mar 28, 2024
3728f12
Update hp-edit.owl
matentzn Mar 28, 2024
2ca8da1
Update src/ontology/hp.Makefile
matentzn Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/ontology_diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: 'Create OAK diffs on Pull requests'

on:
# Triggers the workflow on pull request events for the master branch
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_branch:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v4
- name: Build ontology
run: |
cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE hp.obo -B
cp hp.obo tmp/hp-branch.obo
- name: Upload tmp/hp-branch.obo
uses: actions/upload-artifact@v4
with:
name: hp-branch.obo
path: src/ontology/tmp/hp-branch.obo
retention-days: 1
build_main:
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Classify ontology
run: |
cd src/ontology; make IMP=FALSE PAT=FALSE MIR=FALSE hp.obo -B
cp hp.obo tmp/hp-main.obo
- name: Upload tmp/hp-main.obo
matentzn marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/upload-artifact@v4
with:
name: hp-main.obo
path: src/ontology/tmp/hp-main.obo
retention-days: 1
diff:
needs:
- build_branch
- build_main
runs-on: ubuntu-latest
container: obolibrary/odkfull:v1.5
steps:
- uses: actions/checkout@v4
- name: Download main build
uses: actions/download-artifact@v4
with:
name: hp-main.obo
path: src/ontology/tmp/
- name: Download branch build
uses: actions/download-artifact@v4
with:
name: hp-branch.obo
path: src/ontology/tmp/
- name: Diff classification
run: |
pip install -U oaklib
cd src/ontology;
runoak -i simpleobo:tmp/hp-main.obo diff -X simpleobo:tmp/hp-branch.obo -o reports/difference_main-branch_base.md --output-type md
- name: Upload diff
uses: actions/upload-artifact@v4
with:
name: difference_main-branch_base.md
path: src/ontology/reports/difference_main-branch_base.md
post_comment:
needs: diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download reasoned diff
uses: actions/download-artifact@v4
with:
name: difference_main-branch_base.md
path: src/ontology/reports/
# - name: Prepare reasoned comment
# run: "echo \"<details>\n <summary> Here's a diff of how these changes impact the classified ontology: </summary> \n\" >comment.md; cat src/ontology/reports/difference_main-branch_base.md >>comment.md"
# - name: Post reasoned comment
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# uses: NejcZdovc/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# file: "../../comment.md"
# identifier: "REASONED"
# Post or update comment on pull request if difference_md.md exists
- name: Post or update comment on pull request
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = 'src/ontology/reports/difference_main-branch_base.md';
if (fs.existsSync(path)) {
let content = fs.readFileSync(path, 'utf8');
if (content) {
// GitHub's max issue body size is approximately 65536 characters
const maxBodySize = 65536;
const truncateMsg = '\n</details>\n\n ### WARNING: This diff is too large and has been truncated. For full diff see [here](https://github.com/${{ github.repository }}/blob/${{ github.head_ref }}/src/ontology/reports/difference_main-branch_base.md).';
if (content.length > maxBodySize) {
// Truncate the content to fit within the GitHub comment size limit
content = content.substring(0, maxBodySize - truncateMsg.length) + truncateMsg;
}

const { owner, repo } = context.repo;
const { number } = context.issue;
const existingComments = await github.rest.issues.listComments({
owner,
repo,
issue_number: number
});
const existingComment = existingComments.data.find(comment => comment.user.login === 'github-actions[bot]');
if (existingComment) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body: content
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: number,
body: content
});
}
} else {
console.log("The markdown file is empty."); // Debug print if the file is empty
}
hrshdhgd marked this conversation as resolved.
Show resolved Hide resolved
} else {
console.log("The markdown file does not exist."); // Debug print if the file does not exist
}
30 changes: 30 additions & 0 deletions src/ontology/hp.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -577,3 +577,33 @@ $(TMPDIR)/hp-%-merged.owl: hp-base.owl tmp/%.owl

mappings:
$(MAKE_FAST) ../mappings/hp-snomed.lexmatch.sssom.tsv

##################
### KGCL Diff ####
##################

.PHONY: kgcl-diff
kgcl-diff: kgcl-diff-release-base

.PHONY: kgcl-diff-md-release-base kgcl-diff-table-release-base kgcl-diff-txt-release-base kgcl-diff-yaml-release-base
kgcl-diff-md-release-base: reports/difference_release_base.md
kgcl-diff-table-release-base: reports/difference_release_base.tsv
kgcl-diff-txt-release-base: reports/difference_release_base.txt
kgcl-diff-yaml-release-base: reports/difference_release_base.yaml
kgcl-diff-release-base: kgcl-diff-md-release-base kgcl-diff-table-release-base kgcl-diff-txt-release-base kgcl-diff-yaml-release-base

tmp/hp-released.obo:
wget http://purl.obolibrary.org/obo/hp.obo -O tmp/hp-released.obo

reports/difference_release_base.md: tmp/hp-released.obo hp.obo
runoak -i simpleobo:tmp/hp-released.obo diff -X simpleobo:hp.obo -o $@ --output-type md

reports/difference_release_base.tsv: tmp/hp-released.obo hp.obo
runoak -i simpleobo:tmp/hp-released.obo diff -X simpleobo:hp.obo \
-o $@ --output-type csv --statistics --group-by-property oio:hasOBONamespace

reports/difference_release_base.txt: tmp/hp-released.obo hp.obo
runoak -i simpleobo:tmp/hp-released.obo diff -X simpleobo:hp.obo -o $@ --output-type kgcl

reports/difference_release_base.yaml: tmp/hp-released.obo hp.obo
runoak -i simpleobo:tmp/hp-released.obo diff -X simpleobo:hp.obo -o $@ --output-type yaml
Loading
Loading