Skip to content
Snippets Groups Projects
Commit 181f0fa1 authored by florian's avatar florian
Browse files

DOC: Add excercise to README.md

parent 42912c8f
No related branches found
No related tags found
No related merge requests found
...@@ -23,13 +23,26 @@ where this file resides. ...@@ -23,13 +23,26 @@ where this file resides.
Afterwards adjust the data model, the data and the crawler implementation in Afterwards adjust the data model, the data and the crawler implementation in
`example_cfood.py` as you like. `example_cfood.py` as you like.
## Practice your crawling
After executing `crawl.py` you'll notice that two new experiment records with a
date and a result have been created. However, they are lacking the information
about their project. As an excercise on your way towards developing your own
crawler module, try to implement an project cfood that collects the project
information from the directory name(s) within `data` and creates or updates a
corresponding project record. Afterwards, extend `example_cfood.py` and
`crawl.py` such that the project information is attached to the experiment
records.
## Contributing ## Contributing
Thank you very much to all contributers—[past, present](https://gitlab.com/caosdb/caosdb/-/blob/dev/HUMANS.md), and prospective ones. Thank you very much to all contributers—[past,
present](https://gitlab.com/caosdb/caosdb/-/blob/dev/HUMANS.md), and prospective
ones.
### Code of Conduct ### Code of Conduct
By participating, you are expected to uphold our [Code of Conduct](https://gitlab.com/caosdb/caosdb/-/blob/dev/CODE_OF_CONDUCT.md). By participating, you are expected to uphold our [Code of
Conduct](https://gitlab.com/caosdb/caosdb/-/blob/dev/CODE_OF_CONDUCT.md).
## License ## License
......
...@@ -36,12 +36,15 @@ except ImportError: ...@@ -36,12 +36,15 @@ except ImportError:
class ExampleCFood(AbstractFileCFood): class ExampleCFood(AbstractFileCFood):
@classmethod @classmethod
def get_re(cls): def get_re(cls):
# matches for example `data/2010_TestProject/2019-02-03/README.md` # matches for example `data/2010_TestProject/2019-02-03/result.yml`
# The following groups are created (values for the above example): # The following groups are created (values for the above example):
# - project_identifier: 2010_TestProject # - project_identifier: 2010_TestProject
# - project_year: 2010 # - project_year: 2010
# - project_name: TestProject # - project_name: TestProject
# - date: 2019-02-03 # - date: 2019-02-03
#
# Note that the project is not used in the following example (see
# excercise in the README.md).
return (r".*/(?P<project_identifier>" return (r".*/(?P<project_identifier>"
r"(?P<project_year>\d{4})_?(?P<project_name>((?!/).)*))/" r"(?P<project_year>\d{4})_?(?P<project_name>((?!/).)*))/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment